Mercurial > hg > th-libs
annotate Makefile.gen @ 418:3c1bd6c55e00
Make build process less noisy.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 09 Mar 2016 13:55:48 +0200 |
parents | 137a3cca9a9c |
children | ec109cbaddfb |
rev | line source |
---|---|
406 | 1 CFLAGS += -W -Wall -Wextra -std=c11 -pedantic -I./ -D_XOPEN_SOURCE=500 -DTH_USE_INTERNAL_SPRINTF=1 |
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 | 4 CFLAGS += -DTH_PRINTF_DEBUG=1 |
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 | 14 THLIBS_OBJ=th_util.o th_config.o th_string.o th_ioctx.o \ |
15 th_args.o th_crypto.o th_datastruct.o th_network.o | |
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 | 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 | 33 touch $@ |
310
11cba47777ec
Split some things to a template file th_printf1.c
Matti Hamalainen <ccr@tnsp.org>
parents:
302
diff
changeset
|
34 |
418
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
35 $(OBJPATH) $(BINPATH): |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
36 @echo " MKDIR $@" |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
37 @$(MKDIR_P) $@ |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
417
137a3cca9a9c
Fix build process for parallel make.
Matti Hamalainen <ccr@tnsp.org>
parents:
416
diff
changeset
|
39 $(OBJPATH)%.o: %.c %.h $(THLIBS_DEP) |
418
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
40 @echo " CC $@" |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
41 @$(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS) |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
417
137a3cca9a9c
Fix build process for parallel make.
Matti Hamalainen <ccr@tnsp.org>
parents:
416
diff
changeset
|
43 $(OBJPATH)%.o: %.c $(THLIBS_DEP) |
418
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
44 @echo " CC $@" |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
45 @$(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS) |
254
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 |
417
137a3cca9a9c
Fix build process for parallel make.
Matti Hamalainen <ccr@tnsp.org>
parents:
416
diff
changeset
|
48 $(THLIBS_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ)) |
418
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
49 @echo " AR $@" |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
50 @$(AR) cru $@ $(addprefix $(OBJPATH),$(THLIBS_OBJ)) |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
51 @$(RANLIB) $@ |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 |
302 | 53 $(TESTS_BIN): $(addprefix $(OBJPATH),$(TESTS_OBJ)) $(THLIBS_A) |
418
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
54 @echo " LINK $@" |
3c1bd6c55e00
Make build process less noisy.
Matti Hamalainen <ccr@tnsp.org>
parents:
417
diff
changeset
|
55 @$(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS) |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 |
292 | 57 |
58 check: $(TESTS_BIN) | |
59 $(TESTS_BIN) -v | |
60 | |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 # |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 # Special targets |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 # |
413 | 64 .PHONY: clean srcclean all |
65 | |
254
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 clean: |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 $(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
|
68 |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 srcclean: clean |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 $(RM) *~ |
3d1e2af4e4e6
Start of a very simplistic unit test suite. Initially handling just printf()
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 |