diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-04-11 14:33:32 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-04-11 14:33:32 +0200 |
commit | 9c57e65d348a50a5117807ed8ce2ca995e379e70 (patch) | |
tree | e75dddd3f79f4a8a98130e641e7ce50dd08494ea | |
parent | 67abf0354d231b4d83b7bf473f4bc722c5ba235c (diff) | |
download | libgnunetchat-9c57e65d348a50a5117807ed8ce2ca995e379e70.tar.gz libgnunetchat-9c57e65d348a50a5117807ed8ce2ca995e379e70.zip |
Fixed check target and added dist target
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 37 |
2 files changed, 36 insertions, 4 deletions
@@ -9,3 +9,6 @@ | |||
9 | 9 | ||
10 | # Test files: | 10 | # Test files: |
11 | tests/*.test | 11 | tests/*.test |
12 | |||
13 | # Tar files | ||
14 | libgnunetchat-*.tar.gz | ||
@@ -1,10 +1,13 @@ | |||
1 | 1 | ||
2 | VERSION = 0.1.0 | ||
2 | TARGET_NAME = gnunetchat | 3 | TARGET_NAME = gnunetchat |
3 | SOURCE_DIR = src/ | 4 | SOURCE_DIR = src/ |
4 | INCLUDE_DIR = include/ | 5 | INCLUDE_DIR = include/ |
5 | TESTS_DIR = tests/ | 6 | TESTS_DIR = tests/ |
6 | INSTALL_DIR ?= /usr/local/ | 7 | INSTALL_DIR ?= /usr/local/ |
8 | DOXYGEN_DIR = doc/ | ||
7 | 9 | ||
10 | PACKAGE = lib$(TARGET_NAME) | ||
8 | LIBRARY = lib$(TARGET_NAME).so | 11 | LIBRARY = lib$(TARGET_NAME).so |
9 | SOURCES = gnunet_chat_lib.c\ | 12 | SOURCES = 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 | ||
39 | DIST_FILES = Makefile\ | ||
40 | AUTHORS\ | ||
41 | COPYING\ | ||
42 | Doxyfile\ | ||
43 | HOWTO.md\ | ||
44 | README.md | ||
45 | |||
36 | GNU_CC ?= gcc | 46 | GNU_CC ?= gcc |
37 | GNU_LD ?= gcc | 47 | GNU_LD ?= gcc |
38 | GNU_RM ?= rm | 48 | GNU_RM ?= rm |
49 | GNU_CP ?= cp | ||
50 | GNU_TAR ?= tar | ||
39 | DOXYGEN ?= doxygen | 51 | DOXYGEN ?= doxygen |
40 | 52 | ||
41 | CFLAGS += -fPIC -pedantic -Wall -Wextra -ggdb3 | 53 | CFLAGS += -fPIC -pedantic -Wall -Wextra -ggdb3 |
@@ -44,13 +56,16 @@ LDFLAGS += -shared | |||
44 | DEBUGFLAGS = -O0 -D _DEBUG | 56 | DEBUGFLAGS = -O0 -D _DEBUG |
45 | RELEASEFLAGS = -O2 -D NDEBUG | 57 | RELEASEFLAGS = -O2 -D NDEBUG |
46 | 58 | ||
59 | DIST_DIR = $(PACKAGE)-$(VERSION)/ | ||
60 | DIST_TAR = $(PACKAGE)-$(VERSION).tar.gz | ||
61 | |||
47 | SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES)) | 62 | SOURCE_FILES = $(addprefix $(SOURCE_DIR), $(SOURCES)) |
48 | OBJECT_FILES = $(SOURCE_FILES:%.c=%.o) | 63 | OBJECT_FILES = $(SOURCE_FILES:%.c=%.o) |
49 | HEADER_FILES = $(addprefix $(INCLUDE_DIR), $(HEADERS)) | 64 | HEADER_FILES = $(addprefix $(INCLUDE_DIR), $(HEADERS)) |
50 | TEST_FILES = $(addprefix $(TESTS_DIR), $(TESTS)) | 65 | TEST_FILES = $(addprefix $(TESTS_DIR), $(TESTS)) |
51 | TEST_CASES = $(TEST_FILES:%.c=%.test) | 66 | TEST_CASES = $(TEST_FILES:%.c=%.test) |
52 | LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES)) | 67 | LIBRARY_FLAGS = $(addprefix -l, $(LIBRARIES)) |
53 | TEST_FLAGS = $(LIBRARY_FLAGS) -lcheck -l$(TARGET_NAME) | 68 | TEST_FLAGS = $(LIBRARY_FLAGS) -lcheck -l$(TARGET_NAME) -L. |
54 | 69 | ||
55 | all: $(LIBRARY) | 70 | all: $(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 | ||
69 | check: $(TEST_CASES) | 84 | check: $(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 | |||
107 | dist: 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 | ||
90 | docs: | 118 | docs: |
119 | mkdir -p $(DOXYGEN_DIR) | ||
91 | $(DOXYGEN) | 120 | $(DOXYGEN) |
92 | 121 | ||
93 | .PHONY: clean | 122 | .PHONY: clean |