annotate Makefile.inc @ 482:1013ddd2759b

Add verbose build option.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 19 Feb 2019 05:40:14 +0200
parents b3b8f90bbbe6
children f43c961cc85d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
446
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
1 ifneq ($(BINTOOL_PREFIX),)
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
2 CC = $(BINTOOL_PREFIX)gcc
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
3 CXX = $(BINTOOL_PREFIX)g++
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
4 AR = $(BINTOOL_PREFIX)ar
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
5 RANLIB = $(BINTOOL_PREFIX)ranlib
446
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
6 else
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
7 CC ?= $(BINTOOL_PREFIX)gcc
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
8 CXX ?= $(BINTOOL_PREFIX)g++
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
9 AR ?= $(BINTOOL_PREFIX)ar
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
10 RANLIB ?= $(BINTOOL_PREFIX)ranlib
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
11 endif
e0cead622dce Possibly fix external build things and llvm static analyzer runs.
Matti Hamalainen <ccr@tnsp.org>
parents: 433
diff changeset
12
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
13 INSTALL ?= install
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
14 MKDIR ?= mkdir
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
15 MKDIR_P ?= $(MKDIR) -p
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
16
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
17
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
18 THLIBS_A = $(OBJPATH)thlibs.a
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
19 THLIBS_DEP += $(THLIBS)th_types.h $(THLIBS)th_util.h
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
20
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
21
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
22 NOBUILD_TARGETS +=
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 NOINST_TARGETS += $(THLIBS_A)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
25
482
1013ddd2759b Add verbose build option.
Matti Hamalainen <ccr@tnsp.org>
parents: 474
diff changeset
26 ifneq ($(V),1)
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
27 COMPILE_OBJ = @if test ! -d $(OBJPATH); then mkdir -p $(OBJPATH); fi && echo " CC $<" && $(CC) $(CFLAGS) -c -o $@ $<
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
28 LINK_BIN = @if test ! -d $(BINPATH); then mkdir -p $(BINPATH); fi && echo " LINK $@" && $(CC) -o $@ $(filter %.o %.a,$+) $(LDFLAGS)
482
1013ddd2759b Add verbose build option.
Matti Hamalainen <ccr@tnsp.org>
parents: 474
diff changeset
29 else
1013ddd2759b Add verbose build option.
Matti Hamalainen <ccr@tnsp.org>
parents: 474
diff changeset
30 COMPILE_OBJ = @if test ! -d $(OBJPATH); then mkdir -p $(OBJPATH); fi && echo "$(CC) $(CFLAGS) -c -o $@ $<" && $(CC) $(CFLAGS) -c -o $@ $<
1013ddd2759b Add verbose build option.
Matti Hamalainen <ccr@tnsp.org>
parents: 474
diff changeset
31 LINK_BIN = @if test ! -d $(BINPATH); then mkdir -p $(BINPATH); fi && echo "$(CC) -o $@ $(filter %.o %.a,$+) $(LDFLAGS)" && $(CC) -o $@ $(filter %.o %.a,$+) $(LDFLAGS)
1013ddd2759b Add verbose build option.
Matti Hamalainen <ccr@tnsp.org>
parents: 474
diff changeset
32 endif
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
34 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
35 ## Target rules
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
36 ##
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 $(THLIBS)th_string.c: $(addprefix $(THLIBS), th_printf1.c th_strmatch.c th_string.h)
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
41 @touch $@
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
43
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
44 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS_DEP)
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
45 $(COMPILE_OBJ)
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS)%.h $(THLIBS_DEP)
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
48 $(COMPILE_OBJ) -I$(THLIBS)
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 $(OBJPATH)%.o: %.c %.h $(THLIBS_DEP)
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
51 $(COMPILE_OBJ) -I$(THLIBS)
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 $(OBJPATH)%.o: %.c $(THLIBS_DEP)
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
54 $(COMPILE_OBJ) -I$(THLIBS)
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 $(THLIBS_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ))
423
83fe3a3dcb20 Prettify build.
Matti Hamalainen <ccr@tnsp.org>
parents: 420
diff changeset
58 @echo " AR $@ $(THLIBS_OBJ)"
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 @$(AR) cru $@ $(addprefix $(OBJPATH),$(THLIBS_OBJ))
447
6776928afca1 Add build message for ranlib.
Matti Hamalainen <ccr@tnsp.org>
parents: 446
diff changeset
60 @echo " RANLIB $@"
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 @$(RANLIB) $@
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
63 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
64 ## Generate endian check and config.h
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
65 ##
474
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
66 $(OBJPATH)endianchk.o: $(THLIBS)endianchk.c
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
67 $(COMPILE_OBJ)
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
68
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
69 $(ENDIANCHK_BIN): $(OBJPATH)endianchk.o
b3b8f90bbbe6 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 472
diff changeset
70 $(LINK_BIN)
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
71
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
72 config.h: $(ENDIANCHK_BIN)
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
73 $(ENDIANCHK_BIN) > $@
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
74
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
75
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
76 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
77 ## Special targets
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
78 ##
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 clean:
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 $(RM) $(TARGETS) $(NOINST_TARGETS) $(OBJPATH)*.o
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 srcclean: clean
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 $(RM) *~
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
85 .PHONY: clean srcclean all