annotate Makefile.inc @ 433:0a2f32b8a26e

Improve the build system.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 07 Apr 2017 02:48:31 +0300
parents c3f474e59bc1
children e0cead622dce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
1 CC = $(BINTOOL_PREFIX)gcc
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
2 CXX = $(BINTOOL_PREFIX)g++
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
3 AR = $(BINTOOL_PREFIX)ar
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
4 RANLIB = $(BINTOOL_PREFIX)ranlib
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
5 INSTALL ?= install
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
6 MKDIR ?= mkdir
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
7 MKDIR_P ?= $(MKDIR) -p
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
8
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 NOBUILD_TARGETS += $(OBJPATH) $(BINPATH)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 NOINST_TARGETS += $(THLIBS_A)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
14 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
15 ## Target rules
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
16 ##
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 $(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
21 @touch $@
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 $(OBJPATH) $(BINPATH):
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 @echo " MKDIR $@"
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 @$(MKDIR_P) $@
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS)%.h $(THLIBS_DEP)
423
83fe3a3dcb20 Prettify build.
Matti Hamalainen <ccr@tnsp.org>
parents: 420
diff changeset
28 @echo " CC $@"
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 @$(CC) $(CFLAGS) -c -o $@ $<
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 $(OBJPATH)%.o: %.c %.h $(THLIBS_DEP)
423
83fe3a3dcb20 Prettify build.
Matti Hamalainen <ccr@tnsp.org>
parents: 420
diff changeset
32 @echo " CC $@"
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 @$(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 $(OBJPATH)%.o: %.c $(THLIBS_DEP)
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 @echo " CC $@"
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 @$(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
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_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ))
423
83fe3a3dcb20 Prettify build.
Matti Hamalainen <ccr@tnsp.org>
parents: 420
diff changeset
41 @echo " AR $@ $(THLIBS_OBJ)"
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 @$(AR) cru $@ $(addprefix $(OBJPATH),$(THLIBS_OBJ))
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 @$(RANLIB) $@
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
45 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
46 ## Generate endian check and config.h
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
47 ##
425
c3f474e59bc1 Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 424
diff changeset
48 $(ENDIANCHK_BIN): $(THLIBS)endianchk.c | $(BINPATH) $(OBJPATH)
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
49 @echo " CC $@"
424
aacd4ad3c4ff Fix endianchk build when Makefile.inc is being included from parent project
Matti Hamalainen <ccr@tnsp.org>
parents: 423
diff changeset
50 @$(CC) $(CFLAGS) -o $@ $<
420
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
51
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
52 config.h: $(ENDIANCHK_BIN)
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
53 $(ENDIANCHK_BIN) > $@
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
54
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
55
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
56 ##
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
57 ## Special targets
070fcb008e63 Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 419
diff changeset
58 ##
419
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 clean:
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 $(RM) $(TARGETS) $(NOINST_TARGETS) $(OBJPATH)*.o
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 srcclean: clean
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 $(RM) *~
ec109cbaddfb Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64
433
0a2f32b8a26e Improve the build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 425
diff changeset
65 .PHONY: clean srcclean all