Honour *FLAGS everywhere

Add CPPFLAGS, CFLAGS and LDFLAGS everywhere it's missing.
This commit is contained in:
Thomas Preud'homme 2012-10-22 11:11:42 +02:00
parent 5eb64357b1
commit a7f010ee8a
3 changed files with 19 additions and 17 deletions

View File

@ -5,8 +5,10 @@
TOP ?= .
include $(TOP)/config.mak
CFLAGS_P=$(CFLAGS) -pg -static -DCONFIG_TCC_STATIC
CPPFLAGS_P=$(CPPFLAGS) -DCONFIG_TCC_STATIC
CFLAGS_P=$(CFLAGS) -pg -static
LIBS_P=
LDFLAGS_P=$(LDFLAGS)
ifneq ($(GCC_MAJOR),2)
CFLAGS+=-fno-strict-aliasing
@ -171,11 +173,11 @@ all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
# Host Tiny C Compiler
tcc$(EXESUF): tcc.o $(LIBTCC)
$(CC) -o $@ $^ $(LIBS) $(CFLAGS) $(LDFLAGS) $(LINK_LIBTCC)
$(CC) -o $@ $^ $(LIBS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LINK_LIBTCC)
# Cross Tiny C Compilers
%-tcc$(EXESUF):
$(CC) -o $@ tcc.c -DONE_SOURCE $(DEFINES) $(CFLAGS) $(LIBS) $(LDFLAGS)
$(CC) -o $@ tcc.c -DONE_SOURCE $(DEFINES) $(CPPFLAGS) $(CFLAGS) $(LIBS) $(LDFLAGS)
$(I386_CROSS): DEFINES = -DTCC_TARGET_I386 \
-DCONFIG_TCCDIR="\"$(tccdir)/i386\""
@ -212,25 +214,25 @@ libtcc.o : NATIVE_DEFINES += -DONE_SOURCE
endif
$(LIBTCC_OBJ) tcc.o : %.o : %.c $(LIBTCC_INC)
$(CC) -o $@ -c $< $(NATIVE_DEFINES) $(CFLAGS)
$(CC) -o $@ -c $< $(NATIVE_DEFINES) $(CPPFLAGS) $(CFLAGS)
libtcc.a: $(LIBTCC_OBJ)
$(AR) rcs $@ $^
libtcc.so.1.0: $(LIBTCC_OBJ)
$(CC) -shared -Wl,-soname,$@ -o $@ $^
$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
libtcc.so.1.0: CFLAGS+=-fPIC
# profiling version
tcc_p$(EXESUF): $(NATIVE_FILES)
$(CC) -o $@ $< $(NATIVE_DEFINES) $(CFLAGS_P) $(LIBS_P)
$(CC) -o $@ $< $(NATIVE_DEFINES) $(CPPFLAGS_P) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P)
# windows utilities
tiny_impdef$(EXESUF): win32/tools/tiny_impdef.c
$(CC) -o $@ $< $(CFLAGS)
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
tiny_libmaker$(EXESUF): win32/tools/tiny_libmaker.c
$(CC) -o $@ $< $(CFLAGS)
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
# TinyCC runtime libraries
libtcc1.a : FORCE
@ -238,7 +240,7 @@ libtcc1.a : FORCE
lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
@$(MAKE) -C lib cross TARGET=$*
bcheck.o : lib/bcheck.c
gcc -c $< -o $@ $(CFLAGS)
gcc -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
FORCE:
# install

View File

@ -85,11 +85,11 @@ endif
$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
$(AR) rcs $@ $(OBJ)
$(DIR)/%.o : %.c
$(XCC) -c $< -o $@ $(TGT)
$(XCC) -c $< -o $@ $(CPPFLAGS) $(TGT) $(CFLAGS)
$(DIR)/%.o : %.S
$(XCC) -c $< -o $@ $(TGT)
$(XCC) -c $< -o $@ $(CPPFLAGS) $(TGT) $(CFLAGS)
$(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c
$(CC) -Os -s -w -o $@ $< $(TGT)
$(CC) -Os -s -w -o $@ $< $(CPPFLAGS) $(TGT) $(CFLAGS) $(LDFLAGS)
$(OBJ) $(XAR) : $(DIR)/exists
$(DIR)/exists :

View File

@ -68,13 +68,13 @@ libtest: libtcc_test$(EXESUF) $(LIBTCC1)
./libtcc_test$(EXESUF) lib_path=..
libtcc_test$(EXESUF): libtcc_test.c ../$(LIBTCC)
$(CC) -o $@ $^ -I.. $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC)
$(CC) -o $@ $^ -I.. $(CPPFLAGS) $(CFLAGS) $(NATIVE_DEFINES) $(LIBS) $(LINK_LIBTCC) $(LDFLAGS)
# test.ref - generate using gcc
# copy only tcclib.h so GCC's stddef and stdarg will be used
test.ref: tcctest.c
cp ../include/tcclib.h .
$(CC) -o tcctest.gcc $< -I. -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99
$(CC) -o tcctest.gcc $< -I. $(CPPFLAGS) -w $(CFLAGS) $(NATIVE_DEFINES) -std=gnu99 $(LDFLAGS)
./tcctest.gcc > $@
# auto test
@ -149,14 +149,14 @@ speedtest: ex2 ex3
time $(TCC) -run ../examples/ex3.c 35
weaktest: test.ref
$(TCC) -c tcctest.c -o weaktest.tcc.o
$(CC) -c tcctest.c -o weaktest.gcc.o -I. -w $(CFLAGS)
$(TCC) -c tcctest.c -o weaktest.tcc.o $(CPPFLAGS) $(CFLAGS)
$(CC) -c tcctest.c -o weaktest.gcc.o -I. $(CPPFLAGS) -w $(CFLAGS)
objdump -t weaktest.tcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.tcc.o.txt
objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt
diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK"
ex%: ../examples/ex%.c
$(CC) -o $@ $< $(CFLAGS)
$(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
# tiny assembler testing
asmtest.ref: asmtest.S