aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-04-11 14:33:32 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2022-04-11 14:33:32 +0200
commit9c57e65d348a50a5117807ed8ce2ca995e379e70 (patch)
treee75dddd3f79f4a8a98130e641e7ce50dd08494ea
parent67abf0354d231b4d83b7bf473f4bc722c5ba235c (diff)
downloadlibgnunetchat-9c57e65d348a50a5117807ed8ce2ca995e379e70.tar.gz
libgnunetchat-9c57e65d348a50a5117807ed8ce2ca995e379e70.zip
Fixed check target and added dist target
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--.gitignore3
-rw-r--r--Makefile37
2 files changed, 36 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index fc71951..cac3039 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,6 @@
9 9
10# Test files: 10# Test files:
11tests/*.test 11tests/*.test
12
13# Tar files
14libgnunetchat-*.tar.gz
diff --git a/Makefile b/Makefile
index 6e553d4..f8bf829 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
1 1
2VERSION = 0.1.0
2TARGET_NAME = gnunetchat 3TARGET_NAME = gnunetchat
3SOURCE_DIR = src/ 4SOURCE_DIR = src/
4INCLUDE_DIR = include/ 5INCLUDE_DIR = include/
5TESTS_DIR = tests/ 6TESTS_DIR = tests/
6INSTALL_DIR ?= /usr/local/ 7INSTALL_DIR ?= /usr/local/
8DOXYGEN_DIR = doc/
7 9
10PACKAGE = lib$(TARGET_NAME)
8LIBRARY = lib$(TARGET_NAME).so 11LIBRARY = lib$(TARGET_NAME).so
9SOURCES = gnunet_chat_lib.c\ 12SOURCES = gnunet_chat_lib.c\
10 gnunet_chat_account.c\ 13 gnunet_chat_account.c\
@@ -33,9 +36,18 @@ LIBRARIES = gnunetarm\
33 gnunetregex\ 36 gnunetregex\
34 gnunetutil 37 gnunetutil
35 38
39DIST_FILES = Makefile\
40 AUTHORS\
41 COPYING\
42 Doxyfile\
43 HOWTO.md\
44 README.md
45
36GNU_CC ?= gcc 46GNU_CC ?= gcc
37GNU_LD ?= gcc 47GNU_LD ?= gcc
38GNU_RM ?= rm 48GNU_RM ?= rm
49GNU_CP ?= cp
50GNU_TAR ?= tar
39DOXYGEN ?= doxygen 51DOXYGEN ?= doxygen
40 52
41CFLAGS += -fPIC -pedantic -Wall -Wextra -ggdb3 53CFLAGS += -fPIC -pedantic -Wall -Wextra -ggdb3
@@ -44,13 +56,16 @@ LDFLAGS += -shared
44DEBUGFLAGS = -O0 -D _DEBUG 56DEBUGFLAGS = -O0 -D _DEBUG
45RELEASEFLAGS = -O2 -D NDEBUG 57RELEASEFLAGS = -O2 -D NDEBUG
46 58
59DIST_DIR = $(PACKAGE)-$(VERSION)/
60DIST_TAR = $(PACKAGE)-$(VERSION).tar.gz
61
47SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES)) 62SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES))
48OBJECT_FILES = $(SOURCE_FILES:%.c=%.o) 63OBJECT_FILES = $(SOURCE_FILES:%.c=%.o)
49HEADER_FILES = $(addprefix $(INCLUDE_DIR), $(HEADERS)) 64HEADER_FILES = $(addprefix $(INCLUDE_DIR), $(HEADERS))
50TEST_FILES = $(addprefix $(TESTS_DIR), $(TESTS)) 65TEST_FILES = $(addprefix $(TESTS_DIR), $(TESTS))
51TEST_CASES = $(TEST_FILES:%.c=%.test) 66TEST_CASES = $(TEST_FILES:%.c=%.test)
52LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES)) 67LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES))
53TEST_FLAGS = $(LIBRARY_FLAGS) -lcheck -l$(TARGET_NAME) 68TEST_FLAGS = $(LIBRARY_FLAGS) -lcheck -l$(TARGET_NAME) -L.
54 69
55all: $(LIBRARY) 70all: $(LIBRARY)
56 71
@@ -66,11 +81,13 @@ release: $(LIBRARY)
66$(LIBRARY): $(OBJECT_FILES) 81$(LIBRARY): $(OBJECT_FILES)
67 $(GNU_LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS) 82 $(GNU_LD) $(LDFLAGS) $^ -o $@ $(LIBRARY_FLAGS)
68 83
69check: $(TEST_CASES) 84check: $(LIBRARY) $(TEST_CASES)
70 $(foreach TEST_CASE,$(TEST_CASES),./$(TEST_CASE);) 85 $(foreach TEST_CASE,$(TEST_CASES),LD_LIBRARY_PATH=. ./$(TEST_CASE);)
71 86
72%.test: %.c 87%.test: %.c
73 $(GNU_CC) $(CFLAGS) $< -o $@ -I $(INCLUDE_DIR) $(TEST_FLAGS) 88 ln -s ../$(INCLUDE_DIR) $(addprefix $(TESTS_DIR), gnunet)
89 $(GNU_CC) $(CFLAGS) $< -o $@ -I $(TESTS_DIR) $(TEST_FLAGS)
90 $(GNU_RM) $(addprefix $(TESTS_DIR), gnunet)
74 91
75.PHONY: install 92.PHONY: install
76 93
@@ -85,9 +102,21 @@ uninstall:
85 $(GNU_RM) -f $(addsuffix $(HEADERS), $(addprefix $(INSTALL_DIR), include/gnunet/)) 102 $(GNU_RM) -f $(addsuffix $(HEADERS), $(addprefix $(INSTALL_DIR), include/gnunet/))
86 $(GNU_RM) -f $(addsuffix $(LIBRARY), $(addprefix $(INSTALL_DIR), lib/)) 103 $(GNU_RM) -f $(addsuffix $(LIBRARY), $(addprefix $(INSTALL_DIR), lib/))
87 104
105.PHONY: dist
106
107dist: clean
108 mkdir $(DIST_DIR)
109 $(GNU_CP) -r $(INCLUDE_DIR) $(DIST_DIR)
110 $(GNU_CP) -r $(SOURCE_DIR) $(DIST_DIR)
111 $(GNU_CP) -r $(TESTS_DIR) $(DIST_DIR)
112 $(foreach DIST_FILE,$(DIST_FILES),$(GNU_CP) $(DIST_FILE) $(DIST_DIR);)
113 $(GNU_TAR) -czf $(DIST_TAR) $(DIST_DIR)
114 $(GNU_RM) -r $(DIST_DIR)
115
88.PHONY: docs 116.PHONY: docs
89 117
90docs: 118docs:
119 mkdir -p $(DOXYGEN_DIR)
91 $(DOXYGEN) 120 $(DOXYGEN)
92 121
93.PHONY: clean 122.PHONY: clean