Unified · Split
| @@ -4,7 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | TOP ?= . |
| 6 | 6 | include $(TOP)/config.mak |
| 7 | −VPATH = $(TOP) | |
| 7 | +VPATH = $(TOPSRC) | |
| 8 | +CFLAGS += -I$(TOP) | |
| 8 | 9 | |
| 9 | 10 | ifeq (-$(findstring gcc,$(CC))-,-gcc-) |
| 10 | 11 | ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--) |
| @@ -206,7 +207,7 @@ libtcc.dll : $(LIBTCC_OBJ) tiny_impdef$(EXESUF) · 195 unmodified lines | ||
| 206 | 207 | libtcc.dll : NATIVE_DEFINES += -DLIBTCC_AS_DLL |
| 207 | 208 | |
| 208 | 209 | # windows : utilities |
| 209 | −tiny_%$(EXESUF): $(SRCTOP)/win32/tools/tiny_%.c | |
| 210 | +tiny_%$(EXESUF): $(TOPSRC)/win32/tools/tiny_%.c | |
| 210 | 211 | $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) $(NATIVE_DEFINES) |
| 211 | 212 | |
| 212 | 213 | ifneq ($(LIBTCC1),) |
| @@ -246,21 +247,21 @@ install: $(PROGS) $(TCCLIBS) $(TCCDOCS) · 33 unmodified lines | ||
| 246 | 247 | ifneq ($(LIBTCC1),) |
| 247 | 248 | $(INSTALL) -m644 $(LIBTCC1) "$(tccdir)" |
| 248 | 249 | endif |
| 249 | − $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) tcclib.h "$(tccdir)/include" | |
| 250 | + $(INSTALL) -m644 $(addprefix $(TOPSRC)/include/,$(TCC_INCLUDES)) $(TOPSRC)/tcclib.h "$(tccdir)/include" | |
| 250 | 251 | mkdir -p "$(libdir)" |
| 251 | 252 | $(INSTALL) -m644 $(LIBTCC) "$(libdir)" |
| 252 | 253 | mkdir -p "$(includedir)" |
| 253 | − $(INSTALL) -m644 libtcc.h "$(includedir)" | |
| 254 | + $(INSTALL) -m644 $(TOPSRC)/libtcc.h "$(includedir)" | |
| 254 | 255 | mkdir -p "$(docdir)" |
| 255 | 256 | -$(INSTALL) -m644 tcc-doc.html "$(docdir)" |
| 256 | 257 | ifdef CONFIG_CROSS |
| 257 | 258 | mkdir -p "$(tccdir)/win32/lib/32" |
| 258 | 259 | mkdir -p "$(tccdir)/win32/lib/64" |
| 259 | − $(INSTALL) -m644 win32/lib/*.def "$(tccdir)/win32/lib" | |
| 260 | + $(INSTALL) -m644 $(TOPSRC)/win32/lib/*.def "$(tccdir)/win32/lib" | |
| 260 | 261 | -$(INSTALL) -m644 lib/i386-win32/libtcc1.a "$(tccdir)/win32/lib/32" |
| 261 | 262 | -$(INSTALL) -m644 lib/x86_64-win32/libtcc1.a "$(tccdir)/win32/lib/64" |
| 262 | − cp -r win32/include/. "$(tccdir)/win32/include" | |
| 263 | − cp -r "$(tccdir)/include" "$(tccdir)/win32" | |
| 263 | + cp -r $(TOPSRC)/include/. "$(tccdir)/win32/include" | |
| 264 | + cp -r $(TOPSRC)/win32/include/. "$(tccdir)/win32/include" | |
| 264 | 265 | endif |
| 265 | 266 | |
| 266 | 267 | uninstall: |
| @@ -282,13 +283,13 @@ install: $(PROGS) $(TCCLIBS) $(TCCDOCS) · 15 unmodified lines | ||
| 282 | 283 | mkdir -p "$(tccdir)/doc" |
| 283 | 284 | mkdir -p "$(tccdir)/libtcc" |
| 284 | 285 | $(INSTALLBIN) -m755 $(PROGS) $(LIBTCC) "$(tccdir)" |
| 285 | − $(INSTALL) -m644 libtcc1.a win32/lib/*.def "$(tccdir)/lib" | |
| 286 | − cp -r win32/include/. "$(tccdir)/include" | |
| 287 | − cp -r win32/examples/. "$(tccdir)/examples" | |
| 288 | − cp tests/libtcc_test.c "$(tccdir)/examples" | |
| 289 | − $(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) tcclib.h "$(tccdir)/include" | |
| 290 | − $(INSTALL) -m644 tcc-doc.html win32/tcc-win32.txt "$(tccdir)/doc" | |
| 291 | − $(INSTALL) -m644 libtcc.h libtcc.def "$(tccdir)/libtcc" | |
| 286 | + $(INSTALL) -m644 libtcc1.a $(TOPSRC)/win32/lib/*.def "$(tccdir)/lib" | |
| 287 | + cp -r $(TOPSRC)/win32/include/. "$(tccdir)/include" | |
| 288 | + cp -r $(TOPSRC)/win32/examples/. "$(tccdir)/examples" | |
| 289 | + cp $(TOPSRC)/tests/libtcc_test.c "$(tccdir)/examples" | |
| 290 | + $(INSTALL) -m644 $(addprefix $(TOPSRC)/include/,$(TCC_INCLUDES)) $(TOPSRC)/tcclib.h "$(tccdir)/include" | |
| 291 | + $(INSTALL) -m644 tcc-doc.html $(TOPSRC)/win32/tcc-win32.txt "$(tccdir)/doc" | |
| 292 | + $(INSTALL) -m644 $(TOPSRC)/libtcc.h libtcc.def "$(tccdir)/libtcc" | |
| 292 | 293 | ifdef CONFIG_CROSS |
| 293 | 294 | mkdir -p "$(tccdir)/lib/32" |
| 294 | 295 | mkdir -p "$(tccdir)/lib/64" |
| @@ -519,11 +519,11 @@ echo "@set VERSION $version" > config.texi · 518 unmodified lines | ||
| 519 | 519 | |
| 520 | 520 | if test "$source_path_used" = "yes" ; then |
| 521 | 521 | case $source_path in |
| 522 | − /*) echo "SRCTOP=$source_path";; | |
| 523 | − *) echo "SRCTOP=\$(TOP)/$source_path";; | |
| 522 | + /*) echo "TOPSRC=$source_path";; | |
| 523 | + *) echo "TOPSRC=\$(TOP)/$source_path";; | |
| 524 | 524 | esac >>config.mak |
| 525 | 525 | else |
| 526 | − echo 'SRCTOP=$(TOP)' >>config.mak | |
| 526 | + echo 'TOPSRC=$(TOP)' >>config.mak | |
| 527 | 527 | fi |
| 528 | 528 | |
| 529 | 529 | diff $TMPH config.h >/dev/null 2>&1 |
| @@ -553,7 +553,11 @@ fn_makelink() · 23 unmodified lines | ||
| 553 | 553 | esac |
| 554 | 554 | ;; |
| 555 | 555 | esac |
| 556 | − ln -sfn $tgt $2 | |
| 556 | + if test "$mingw32" = "yes" ; then | |
| 557 | + cmd //c mklink `echo "$2 $tgt" | sed 's,/,\\\\,g'` | |
| 558 | + else | |
| 559 | + ln -sfn $tgt $2 | |
| 560 | + fi | |
| 557 | 561 | } |
| 558 | 562 | |
| 559 | 563 | if test "$source_path_used" = "yes" ; then |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | TOP = .. |
| 6 | 6 | include $(TOP)/Makefile |
| 7 | −VPATH = $(TOP)/lib $(TOP)/win32/lib | |
| 7 | +VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib | |
| 8 | 8 | |
| 9 | 9 | ifndef TARGET |
| 10 | 10 | # we're building the native libtcc1.a |
| @@ -51,31 +51,31 @@ PICFLAGS = -fPIC · 40 unmodified lines | ||
| 51 | 51 | ifeq "$(TARGET)" "i386-win32" |
| 52 | 52 | OBJ = $(addprefix $(DIR)/,$(WIN32_O)) |
| 53 | 53 | TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE |
| 54 | − XCC = $(TCC) -B$(TOP)/win32 -I$(TOP)/include | |
| 54 | + XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include | |
| 55 | 55 | XAR = $(DIR)/tiny_libmaker$(EXESUF) |
| 56 | 56 | XFLAGS = $(TGT) |
| 57 | 57 | else ifeq "$(TARGET)" "x86_64-win32" |
| 58 | 58 | OBJ = $(addprefix $(DIR)/,$(WIN64_O)) |
| 59 | 59 | TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE |
| 60 | − XCC = $(TCC) -B$(TOP)/win32 -I$(TOP)/include | |
| 60 | + XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include | |
| 61 | 61 | XAR = $(DIR)/tiny_libmaker$(EXESUF) |
| 62 | 62 | XFLAGS = $(TGT) |
| 63 | 63 | else ifeq "$(TARGET)" "i386" |
| 64 | 64 | OBJ = $(addprefix $(DIR)/,$(I386_O)) |
| 65 | 65 | TGT = -DTCC_TARGET_I386 |
| 66 | − XCC ?= $(TCC) -B$(TOP) | |
| 66 | + XCC ?= $(TCC) -B$(TOPSRC) | |
| 67 | 67 | else ifeq "$(TARGET)" "x86_64" |
| 68 | 68 | OBJ = $(addprefix $(DIR)/,$(X86_64_O)) |
| 69 | 69 | TGT = -DTCC_TARGET_X86_64 |
| 70 | − XCC ?= $(TCC) -B$(TOP) | |
| 70 | + XCC ?= $(TCC) -B$(TOPSRC) | |
| 71 | 71 | else ifeq "$(TARGET)" "arm" |
| 72 | 72 | OBJ = $(addprefix $(DIR)/,$(ARM_O)) |
| 73 | 73 | TGT = -DTCC_TARGET_ARM |
| 74 | − XCC ?= $(TCC) -B$(TOP) | |
| 74 | + XCC ?= $(TCC) -B$(TOPSRC) | |
| 75 | 75 | else ifeq "$(TARGET)" "arm64" |
| 76 | 76 | OBJ = $(addprefix $(DIR)/,$(ARM64_O)) |
| 77 | 77 | TGT = -DTCC_TARGET_ARM64 |
| 78 | − XCC ?= $(TCC) -B$(top_srcdir) | |
| 78 | + XCC ?= $(TCC) -B$(TOPSRC) | |
| 79 | 79 | else |
| 80 | 80 | $(error libtcc1.a not supported on target '$(TARGET)') |
| 81 | 81 | endif |
| @@ -99,7 +99,7 @@ $(DIR)/%.o : %.c · 17 unmodified lines | ||
| 99 | 99 | $(DIR)/%.o : %.S |
| 100 | 100 | $(XCC) -c $< -o $@ $(XFLAGS) |
| 101 | 101 | # windows : utilities |
| 102 | −$(DIR)/tiny_%$(EXESUF) : $(TOP)/win32/tools/tiny_%.c | |
| 102 | +$(DIR)/tiny_%$(EXESUF) : $(TOPSRC)/win32/tools/tiny_%.c | |
| 103 | 103 | $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) $(TGT) |
| 104 | 104 | |
| 105 | 105 | $(OBJ) $(XAR) : $(DIR)/exists |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | TOP = .. |
| 6 | 6 | include $(TOP)/Makefile |
| 7 | −VPATH = $(TOP)/tests $(TOP) | |
| 8 | −CFLAGS = -I$(TOP) | |
| 7 | +VPATH = $(TOPSRC)/tests $(TOPSRC) $(TOP) | |
| 8 | +CFLAGS = -I$(TOPSRC) -I$(TOP) | |
| 9 | 9 | |
| 10 | 10 | # what tests to run |
| 11 | 11 | TESTS = \ |
| @@ -42,14 +42,14 @@ ifeq ($(CONFIG_arm_eabi),yes) · 30 unmodified lines | ||
| 42 | 42 | endif |
| 43 | 43 | |
| 44 | 44 | # run local version of tcc with local libraries and includes |
| 45 | −TCCFLAGS = -B$(TOP) -I$(TOP) | |
| 45 | +TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) | |
| 46 | 46 | ifdef CONFIG_WIN32 |
| 47 | − TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP) | |
| 47 | + TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) | |
| 48 | 48 | PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll |
| 49 | 49 | endif |
| 50 | 50 | |
| 51 | 51 | TCC = $(TOP)/tcc $(TCCFLAGS) |
| 52 | −RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS) | |
| 52 | +RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) | |
| 53 | 53 | |
| 54 | 54 | ifeq ($(TARGETOS),Darwin) |
| 55 | 55 | CFLAGS += -Wl,-flat_namespace,-undefined,warning |
| @@ -154,9 +154,9 @@ btest: boundtest.c · 98 unmodified lines | ||
| 154 | 154 | speedtest: ex2 ex3 |
| 155 | 155 | @echo ------------ $@ ------------ |
| 156 | 156 | time ./ex2 1238 2 3 4 10 13 4 |
| 157 | − time $(TCC) -run $(TOP)/examples/ex2.c 1238 2 3 4 10 13 4 | |
| 157 | + time $(TCC) -run $(TOPSRC)/examples/ex2.c 1238 2 3 4 10 13 4 | |
| 158 | 158 | time ./ex3 35 |
| 159 | − time $(TCC) -run $(TOP)/examples/ex3.c 35 | |
| 159 | + time $(TCC) -run $(TOPSRC)/examples/ex3.c 35 | |
| 160 | 160 | |
| 161 | 161 | weaktest: tcctest.c test.ref |
| 162 | 162 | $(TCC) -c $< -o weaktest.tcc.o |
| @@ -165,7 +165,7 @@ weaktest: tcctest.c test.ref · 2 unmodified lines | ||
| 165 | 165 | objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt |
| 166 | 166 | diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK" |
| 167 | 167 | |
| 168 | −ex%: $(TOP)/examples/ex%.c | |
| 168 | +ex%: $(TOPSRC)/examples/ex%.c | |
| 169 | 169 | $(CC) -o $@ $< $(CFLAGS) |
| 170 | 170 | |
| 171 | 171 | # tiny assembler testing |
| @@ -2,8 +2,13 @@ · 1 unmodified line | ||
| 2 | 2 | # credits: 01..13.c from the pcc cpp-tests suite |
| 3 | 3 | # |
| 4 | 4 | |
| 5 | +TOP = ../.. | |
| 6 | +include $(TOP)/config.mak | |
| 7 | +SRC = $(TOPSRC)/tests/pp | |
| 8 | +VPATH = $(SRC) | |
| 9 | + | |
| 5 | 10 | TCC = ../../tcc |
| 6 | −files = $(patsubst %.$1,%.test,$(wildcard *.$1)) | |
| 11 | +files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1))) | |
| 7 | 12 | TESTS = $(call files,c) $(call files,S) |
| 8 | 13 | |
| 9 | 14 | all test : $(sort $(TESTS)) |
| @@ -13,13 +18,13 @@ DIFF_OPTS = -Nu -b -B -I "^\#" · 3 unmodified lines | ||
| 13 | 18 | %.test: %.c %.expect |
| 14 | 19 | @echo PPTest $* ... |
| 15 | 20 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ |
| 16 | − diff $(DIFF_OPTS) $*.expect $*.output \ | |
| 21 | + diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ | |
| 17 | 22 | && rm -f $*.output |
| 18 | 23 | |
| 19 | 24 | %.test: %.S %.expect |
| 20 | 25 | @echo PPTest $* ... |
| 21 | 26 | -@$(TCC) -E -P $< >$*.output 2>&1 ; \ |
| 22 | − diff $(DIFF_OPTS) $*.expect $*.output \ | |
| 27 | + diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \ | |
| 23 | 28 | && rm -f $*.output |
| 24 | 29 | |
| 25 | 30 | # automatically generate .expect files with gcc: |
| @@ -1,14 +1,16 @@ | ||
| 1 | 1 | TOP = ../.. |
| 2 | −include $(TOP)/Makefile | |
| 2 | +include $(TOP)/config.mak | |
| 3 | +SRC = $(TOPSRC)/tests/tests2 | |
| 4 | +VPATH = $(SRC) | |
| 3 | 5 | |
| 4 | 6 | # run local version of tcc with local libraries and includes |
| 5 | −TCCFLAGS = -B$(TOP) -I$(TOP) | |
| 7 | +TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include | |
| 6 | 8 | ifdef CONFIG_WIN32 |
| 7 | − TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP) | |
| 9 | + TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP) | |
| 8 | 10 | endif |
| 9 | 11 | TCC = $(TOP)/tcc $(TCCFLAGS) |
| 10 | 12 | |
| 11 | −TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c))) | |
| 13 | +TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c)))) | |
| 12 | 14 | |
| 13 | 15 | # 34_array_assignment.test -- array assignment is not in C standard |
| 14 | 16 | SKIP = 34_array_assignment.test |
| @@ -34,15 +36,16 @@ endif · 19 unmodified lines | ||
| 34 | 36 | # Some tests might need arguments |
| 35 | 37 | ARGS = |
| 36 | 38 | 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5 |
| 37 | −46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c | |
| 39 | +46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c | |
| 38 | 40 | |
| 39 | 41 | # Some tests might need different flags |
| 40 | 42 | 76_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers |
| 41 | 43 | |
| 44 | +# Filter source directory in warnings/errors (out-of-tree builds) | |
| 45 | +FILTER = 2>&1 | sed 's,$(SRC)/,,g' | |
| 42 | 46 | # Filter some always-warning |
| 43 | −FILTER = | |
| 44 | 47 | ifeq (-$(findstring arm,$(ARCH))-,-arm-) |
| 45 | −FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported' | |
| 48 | +FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported' | |
| 46 | 49 | endif |
| 47 | 50 | |
| 48 | 51 | all test: $(filter-out $(SKIP),$(TESTS)) |
| @@ -51,10 +54,7 @@ all test: $(filter-out $(SKIP),$(TESTS)) · 2 unmodified lines | ||
| 51 | 54 | @echo Test: $*... |
| 52 | 55 | # test -run |
| 53 | 56 | @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true |
| 54 | − @diff -Nbu $*.expect $*.output && rm -f $*.output | |
| 55 | −# test exe (disabled for speed) | |
| 56 | −# @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \ | |
| 57 | −# diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe | |
| 57 | + @diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output | |
| 58 | 58 | |
| 59 | 59 | # automatically generate .expect files with gcc: |
| 60 | 60 | %.expect : |