Mercurial > hg > th-libs
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 |
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 | 2 CC = $(BINTOOL_PREFIX)gcc |
3 CXX = $(BINTOOL_PREFIX)g++ | |
4 AR = $(BINTOOL_PREFIX)ar | |
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 | 13 INSTALL ?= install |
14 MKDIR ?= mkdir | |
15 MKDIR_P ?= $(MKDIR) -p | |
16 | |
474 | 17 |
18 THLIBS_A = $(OBJPATH)thlibs.a | |
19 THLIBS_DEP += $(THLIBS)th_types.h $(THLIBS)th_util.h | |
20 | |
21 | |
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 | 25 |
482 | 26 ifneq ($(V),1) |
474 | 27 COMPILE_OBJ = @if test ! -d $(OBJPATH); then mkdir -p $(OBJPATH); fi && echo " CC $<" && $(CC) $(CFLAGS) -c -o $@ $< |
28 LINK_BIN = @if test ! -d $(BINPATH); then mkdir -p $(BINPATH); fi && echo " LINK $@" && $(CC) -o $@ $(filter %.o %.a,$+) $(LDFLAGS) | |
482 | 29 else |
30 COMPILE_OBJ = @if test ! -d $(OBJPATH); then mkdir -p $(OBJPATH); fi && echo "$(CC) $(CFLAGS) -c -o $@ $<" && $(CC) $(CFLAGS) -c -o $@ $< | |
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) | |
32 endif | |
419
ec109cbaddfb
Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 |
420 | 34 ## |
35 ## Target rules | |
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 | 41 @touch $@ |
419
ec109cbaddfb
Split some build stuff into Makefile.inc
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
474 | 43 |
44 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS_DEP) | |
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 | 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 | 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 | 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 | 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 | 63 ## |
64 ## Generate endian check and config.h | |
65 ## | |
474 | 66 $(OBJPATH)endianchk.o: $(THLIBS)endianchk.c |
67 $(COMPILE_OBJ) | |
68 | |
69 $(ENDIANCHK_BIN): $(OBJPATH)endianchk.o | |
70 $(LINK_BIN) | |
420 | 71 |
72 config.h: $(ENDIANCHK_BIN) | |
73 $(ENDIANCHK_BIN) > $@ | |
74 | |
75 | |
76 ## | |
77 ## Special targets | |
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 | 85 .PHONY: clean srcclean all |