| 0 | 2 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,38 @@ |
| 1 |
+## Project specific variables |
|
| 2 |
+PROG = sockchat |
|
| 3 |
+ |
|
| 4 |
+## Custom variable defaults |
|
| 5 |
+BUILD ?= debug |
|
| 6 |
+ |
|
| 7 |
+## Built-in variable defaults |
|
| 8 |
+CFLAGS += -Wall -Wextra -Werror -pedantic |
|
| 9 |
+ |
|
| 10 |
+## Standard variable defaults |
|
| 11 |
+PREFIX ?= /usr/local |
|
| 12 |
+DESTDIR ?= |
|
| 13 |
+INSTALL ?= install |
|
| 14 |
+INSTALL_PROGRAM ?= $(INSTALL) |
|
| 15 |
+ |
|
| 16 |
+## Build type |
|
| 17 |
+ifeq ($(BUILD),debug) |
|
| 18 |
+ CFLAGS += -g |
|
| 19 |
+else ifeq ($(BUILD),release) |
|
| 20 |
+ CFLAGS += -DNDEBUG -O3 |
|
| 21 |
+ LDFLAGS += -s |
|
| 22 |
+endif |
|
| 23 |
+ |
|
| 24 |
+## Standard targets |
|
| 25 |
+ |
|
| 26 |
+.PHONY: all |
|
| 27 |
+all: $(PROG) |
|
| 28 |
+ |
|
| 29 |
+.PHONY: install |
|
| 30 |
+install: all |
|
| 31 |
+ $(INSTALL_PROGRAM) -D -t $(DESTDIR)$(PREFIX)/bin $(PROG) |
|
| 32 |
+ |
|
| 33 |
+.PHONY: clean |
|
| 34 |
+clean: |
|
| 35 |
+ |
|
| 36 |
+.PHONY: distclean |
|
| 37 |
+distclean: clean |
|
| 38 |
+ $(RM) $(PROG) |
| ... | ... |
@@ -2,6 +2,23 @@ |
| 2 | 2 |
|
| 3 | 3 |
Chat with unlimited number of peers through a variety of sockets. |
| 4 | 4 |
|
| 5 |
+## Building |
|
| 6 |
+ |
|
| 7 |
+A simple [`Makefile`](Makefile) is provided, build with |
|
| 8 |
+ |
|
| 9 |
+```sh |
|
| 10 |
+make |
|
| 11 |
+``` |
|
| 12 |
+ |
|
| 13 |
+## Installation |
|
| 14 |
+ |
|
| 15 |
+The produced executable is self-contained and can be run from wherever, but can |
|
| 16 |
+be installed with |
|
| 17 |
+ |
|
| 18 |
+```sh |
|
| 19 |
+make install |
|
| 20 |
+``` |
|
| 21 |
+ |
|
| 5 | 22 |
## License |
| 6 | 23 |
|
| 7 | 24 |
Licensed under the [ISC License][], see the [`LICENSE`](LICENSE) file. |