aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..364c1fc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
1
2SOURCE_DIR = src/
3INSTALL_DIR = /usr/local/
4
5BINARY = messenger-cli
6SOURCES = messenger_cli.c
7HEADERS =
8
9LIBRARIES = gnunetchat
10
11CC = gcc
12LD = gcc
13RM = rm
14
15CFLAGS = -pedantic -Wall -Wextra -march=native -ggdb3
16LDFLAGS =
17
18DEBUGFLAGS = -O0 -D _DEBUG
19RELEASEFLAGS = -O2 -D NDEBUG -fwhole-program
20
21SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES))
22OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
23HEADER_FILES = $(addprefix $(SOURCE_DIR), $(HEADERS))
24LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
25
26all: $(BINARY)
27
28debug: CFLAGS += $(DEBUGFLAGS)
29debug: $(BINARY)
30
31release: CFLAGS += $(RELEASEFLAGS)
32release: $(BINARY)
33
34%.o: %.c
35 $(CC) $(CFLAGS) -c $< -o $@ $(LIBRARY_FLAGS)
36
37$(BINARY): $(OBJECT_FILES)
38 $(LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS)
39
40.PHONY: install
41
42install:
43 install -m 755 $(BINARY) $(addprefix $(INSTALL_DIR), bin/)
44
45.PHONY: uninstall
46
47uninstall:
48 $(RM) -f $(addsuffix $(BINARY), $(addprefix $(INSTALL_DIR), bin/))
49
50.PHONY: clean
51
52clean:
53 $(RM) -f $(BINARY)
54 $(RM) -f $(OBJECT_FILES) \ No newline at end of file