mirror of
https://github.com/frida/tinycc
synced 2024-12-22 13:12:34 +03:00
5f33d313c8
Forgot about it. It allows to compile several sources (and other .o's) to one single .o file; tcc -r -o all.o f1.c f2.c f3.S o4.o ... Also: - option -fold-struct-init-code removed, no effect anymore - (tcc_)set_environment() moved to tcc.c - win32/lib/(win)crt1 minor fix & add dependency - debug line output for asm (tcc -c -g xxx.S) enabled - configure/Makefiles: x86-64 -> x86_64 changes - README: cleanup
74 lines
2.0 KiB
Makefile
74 lines
2.0 KiB
Makefile
TOP = ../..
|
|
include $(TOP)/config.mak
|
|
SRC = $(TOPSRC)/tests/tests2
|
|
VPATH = $(SRC)
|
|
|
|
# run local version of tcc with local libraries and includes
|
|
TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include
|
|
ifdef CONFIG_WIN32
|
|
TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP)
|
|
endif
|
|
TCC = $(TOP)/tcc $(TCCFLAGS)
|
|
|
|
TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c))))
|
|
|
|
# 34_array_assignment.test -- array assignment is not in C standard
|
|
SKIP = 34_array_assignment.test
|
|
|
|
# some tests do not pass on all platforms, remove them for now
|
|
ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
|
|
SKIP += 22_floating_point.test
|
|
endif
|
|
ifeq ($(TARGETOS),Darwin)
|
|
SKIP += 40_stdio.test
|
|
endif
|
|
ifeq ($(ARCH),x86_64)
|
|
SKIP += 73_arm64.test
|
|
endif
|
|
ifeq (,$(filter i386 x86_64,$(ARCH)))
|
|
SKIP += 85_asm-outside-function.test
|
|
endif
|
|
|
|
# Some tests might need arguments
|
|
ARGS =
|
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
|
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
|
|
|
|
# And some tests don't test the right thing with -run
|
|
NORUN =
|
|
42_function_pointer.test : NORUN = true
|
|
|
|
# Some tests might need different flags
|
|
FLAGS =
|
|
76_dollars_in_identifiers.test : FLAGS += -fdollars-in-identifiers
|
|
|
|
# Filter source directory in warnings/errors (out-of-tree builds)
|
|
FILTER = 2>&1 | sed 's,$(SRC)/,,g'
|
|
# Filter some always-warning
|
|
ifeq (-$(findstring arm,$(ARCH))-,-arm-)
|
|
FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported'
|
|
endif
|
|
|
|
all test: $(filter-out $(SKIP),$(TESTS))
|
|
|
|
%.test: %.c %.expect
|
|
@echo Test: $*...
|
|
# test -run
|
|
@if test -z "$(NORUN)"; then \
|
|
$(TCC) $(FLAGS) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true; \
|
|
else \
|
|
$(TCC) $(FLAGS) $< -o ./$*.exe $(FILTER) >$*.output 2>&1; \
|
|
./$*.exe $(ARGS) >>$*.output 2>&1 || true; \
|
|
fi
|
|
@diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output $*.exe
|
|
|
|
# automatically generate .expect files with gcc:
|
|
%.expect : # %.c
|
|
(gcc -w $*.c -o a.exe && ./a.exe $(ARGS)) $(FILTER) >$*.expect 2>&1; rm -f a.exe
|
|
|
|
# tell make not to delete
|
|
.PRECIOUS: %.expect
|
|
|
|
clean:
|
|
rm -f fred.txt *.output a.exe
|