aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile65
1 files changed, 65 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..895cd64
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,65 @@
1
2SOURCE_DIR = src/
3INCLUDE_DIR = include/
4INSTALL_DIR = /usr/local/
5
6LIBRARY = libgnunetchat.so
7SOURCES = gnunet_chat_handle.c\
8 gnunet_chat_contact.c\
9 gnunet_chat_group.c\
10 gnunet_chat_context.c\
11 gnunet_chat_message.c
12HEADERS = gnunet_chat_lib.h
13
14LIBRARIES = gnunetarm\
15 gnunetfs\
16 gnunetmessenger\
17 gnunetregex\
18 gnunetutil
19
20CC = gcc
21LD = gcc
22RM = rm
23
24CFLAGS = -fPIC -pedantic -Wall -Wextra -march=native -ggdb3
25LDFLAGS = -shared
26
27DEBUGFLAGS = -O0 -D _DEBUG
28RELEASEFLAGS = -O2 -D NDEBUG
29
30SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES))
31OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
32HEADER_FILES = $(addprefix $(INCLUDE_DIR), $(HEADERS))
33LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
34
35all: $(LIBRARY)
36
37debug: CFLAGS += $(DEBUGFLAGS)
38debug: $(LIBRARY)
39
40release: CFLAGS += $(RELEASEFLAGS)
41release: $(LIBRARY)
42
43%.o: %.c
44 $(CC) $(CFLAGS) -c $< -o $@ -I $(INCLUDE_DIR) $(LIBRARY_FLAGS)
45
46$(LIBRARY): $(OBJECT_FILES)
47 $(LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS)
48
49.PHONY: install
50
51install:
52 install -m 755 $(LIBRARY) $(addprefix $(INSTALL_DIR), lib/)
53 install -m 644 $(HEADER_FILES) $(addprefix $(INSTALL_DIR), include/gnunet/)
54
55.PHONY: uninstall
56
57uninstall:
58 $(RM) -f $(addsuffix $(HEADERS), $(addprefix $(INSTALL_DIR), include/gnunet/))
59 $(RM) -f $(addsuffix $(LIBRARY), $(addprefix $(INSTALL_DIR), lib/))
60
61.PHONY: clean
62
63clean:
64 $(RM) -f $(LIBRARY)
65 $(RM) -f $(OBJECT_FILES) \ No newline at end of file