annotate Makefile.gen @ 416:2503cd600c8f

Improve build rule for th_string.c depencies.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 09 Mar 2016 13:23:24 +0200
parents bb7120c11f8e
children 137a3cca9a9c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
406
30432a52026a Adjust build flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 382
diff changeset
1 CFLAGS += -W -Wall -Wextra -std=c11 -pedantic -I./ -D_XOPEN_SOURCE=500 -DTH_USE_INTERNAL_SPRINTF=1
30432a52026a Adjust build flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 382
diff changeset
2 CFLAGS += -g
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 CFLAGS += -O2
406
30432a52026a Adjust build flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 382
diff changeset
4 CFLAGS += -DTH_PRINTF_DEBUG=1
30432a52026a Adjust build flags.
Matti Hamalainen <ccr@tnsp.org>
parents: 382
diff changeset
5 THLIBS = ./
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 MKDIR ?= mkdir
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 MKDIR_P ?= $(MKDIR) -p
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 # Objects
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 THLIBS_A=$(OBJPATH)thlibs.a
273
7bea1d5ab944 Build all modules.
Matti Hamalainen <ccr@tnsp.org>
parents: 254
diff changeset
14 THLIBS_OBJ=th_util.o th_config.o th_string.o th_ioctx.o \
7bea1d5ab944 Build all modules.
Matti Hamalainen <ccr@tnsp.org>
parents: 254
diff changeset
15 th_args.o th_crypto.o th_datastruct.o th_network.o
7bea1d5ab944 Build all modules.
Matti Hamalainen <ccr@tnsp.org>
parents: 254
diff changeset
16
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 TESTS_OBJ=tests.o
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 TESTS_BIN=$(BINPATH)tests$(EXEEXT)
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 TARGETS += $(TESTS_BIN)
294
3835423074c0 Fix 'make check'. :S
Matti Hamalainen <ccr@tnsp.org>
parents: 292
diff changeset
23 NOBUILD_TARGETS += $(OBJPATH) $(BINPATH)
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 NOINST_TARGETS += $(THLIBS_A)
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 # Target rules
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #
316
d4a069014899 Don't run 'check' target through 'all'.
Matti Hamalainen <ccr@tnsp.org>
parents: 310
diff changeset
30 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS)
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
416
2503cd600c8f Improve build rule for th_string.c depencies.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
32 $(THLIBS)th_string.c: $(addprefix $(THLIBS), th_printf1.c th_strmatch.c th_string.h)
413
bb7120c11f8e Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 406
diff changeset
33 touch $@
310
11cba47777ec Split some things to a template file th_printf1.c
Matti Hamalainen <ccr@tnsp.org>
parents: 302
diff changeset
34
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 $(OBJPATH):
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 $(MKDIR_P) $@
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 $(BINPATH):
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 $(MKDIR_P) $@
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS)%.h
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 $(CC) $(CFLAGS) -c -o $@ $<
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 $(OBJPATH)%.o: %.c %.h
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 $(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 $(OBJPATH)%.o: %.c
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 $(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
302
3f05f6fb5dfd Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
51 $(THLIBS_A): $(THLIBS_DEP) $(addprefix $(OBJPATH),$(THLIBS_OBJ))
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 $(AR) cru $@ $(addprefix $(OBJPATH),$(THLIBS_OBJ))
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 $(RANLIB) $@
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
302
3f05f6fb5dfd Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 294
diff changeset
55 $(TESTS_BIN): $(addprefix $(OBJPATH),$(TESTS_OBJ)) $(THLIBS_A)
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
292
54032f17c7e5 Add 'make check' target.
Matti Hamalainen <ccr@tnsp.org>
parents: 273
diff changeset
58
54032f17c7e5 Add 'make check' target.
Matti Hamalainen <ccr@tnsp.org>
parents: 273
diff changeset
59 check: $(TESTS_BIN)
54032f17c7e5 Add 'make check' target.
Matti Hamalainen <ccr@tnsp.org>
parents: 273
diff changeset
60 $(TESTS_BIN) -v
54032f17c7e5 Add 'make check' target.
Matti Hamalainen <ccr@tnsp.org>
parents: 273
diff changeset
61
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 #
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 # Special targets
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 #
413
bb7120c11f8e Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 406
diff changeset
65 .PHONY: clean srcclean all
bb7120c11f8e Improve build process.
Matti Hamalainen <ccr@tnsp.org>
parents: 406
diff changeset
66
254
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 clean:
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 $(RM) $(TARGETS) $(NOINST_TARGETS) $(OBJPATH)*.o
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 srcclean: clean
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 $(RM) *~
3d1e2af4e4e6 Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72