Mercurial > hg > th-libs
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 |
rev | line source |
---|---|
433 | 1 CC = $(BINTOOL_PREFIX)gcc |
2 CXX = $(BINTOOL_PREFIX)g++ | |
3 AR = $(BINTOOL_PREFIX)ar | |
4 RANLIB = $(BINTOOL_PREFIX)ranlib | |
5 INSTALL ?= install | |
6 MKDIR ?= mkdir | |
7 MKDIR_P ?= $(MKDIR) -p | |
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 | 14 ## |
15 ## Target rules | |
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 | 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 | 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 | 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 | 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 | 45 ## |
46 ## Generate endian check and config.h | |
47 ## | |
425 | 48 $(ENDIANCHK_BIN): $(THLIBS)endianchk.c | $(BINPATH) $(OBJPATH) |
420 | 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 | 51 |
52 config.h: $(ENDIANCHK_BIN) | |
53 $(ENDIANCHK_BIN) > $@ | |
54 | |
55 | |
56 ## | |
57 ## Special targets | |
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 | 65 .PHONY: clean srcclean all |