mirror of
https://github.com/frida/tinycc
synced 2024-12-03 21:01:54 +03:00
30df3189b1
* fix some macro expansion issues * add some pp tests in tests/pp * improved tcc -E output for better diff'ability * remove -dD feature (quirky code, exotic feature, didn't work well) Based partially on ideas / researches from PipCet Some issues remain with VA_ARGS macros (if used in a rather tricky way). Also, to keep it simple, the pp doesn't automtically add any extra spaces to separate tokens which otherwise would form wrong tokens if re-read from tcc -E output (such as '+' '=') GCC does that, other compilers don't. * cleanups - #line 01 "file" / # 01 "file" processing - #pragma comment(lib,"foo") - tcc -E: forward some pragmas to output (pack, comment(lib)) - fix macro parameter list parsing mess froma3fc543459
a715d7143d
(some coffee might help, next time ;) - introduce TOK_PPSTR - to have character constants as written in the file (similar to TOK_PPNUM) - allow '\' appear in macros - new functions begin/end_macro to: - fix switching macro levels during expansion - allow unget_tok to unget more than one tok - slight speedup by using bitflags in isidnum_table Also: - x86_64.c : fix decl after statements - i386-gen,c : fix a vstack leak with VLA on windows - configure/Makefile : build on windows (MSYS) was broken - tcc_warning: fflush stderr to keep output order (win32)
77 lines
1.9 KiB
Makefile
77 lines
1.9 KiB
Makefile
TOP = ../..
|
|
include $(TOP)/Makefile
|
|
|
|
# clear CFLAGS and LDFLAGS
|
|
CFLAGS :=
|
|
LDFLAGS :=
|
|
|
|
ifdef CONFIG_WIN32
|
|
TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
|
|
else
|
|
TCCFLAGS = -B$(TOP) -I$(top_srcdir)/include -lm
|
|
endif
|
|
|
|
ifeq ($(TARGETOS),Darwin)
|
|
CFLAGS += -Wl,-flat_namespace,-undefined,warning
|
|
TCCFLAGS += -D_ANSI_SOURCE
|
|
export MACOSX_DEPLOYMENT_TARGET:=10.2
|
|
endif
|
|
|
|
TCC = $(TOP)/tcc $(TCCFLAGS)
|
|
|
|
TESTS = $(patsubst %.c,%.test,$(wildcard *.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
|
|
ifdef CONFIG_WIN32
|
|
SKIP += 24_math_library.test # don't have round()
|
|
SKIP += 28_strings.test # don't have r/index() / strings.h
|
|
endif
|
|
ifeq ($(ARCH),x86-64)
|
|
SKIP += 73_arm64.test
|
|
endif
|
|
|
|
# Some tests might need arguments
|
|
ARGS =
|
|
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
|
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
|
|
|
|
# Some tests might need different flags
|
|
FLAGS =
|
|
76_dollars_in_identifiers.test : FLAGS = -fdollars-in-identifiers
|
|
|
|
# Filter some always-warning
|
|
FILTER =
|
|
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
|
|
@$(TCC) $(FLAGS) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true
|
|
@diff -Nbu $*.expect $*.output && rm -f $*.output
|
|
# test exe (disabled for speed)
|
|
# @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \
|
|
# diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe
|
|
|
|
# automatically generate .expect files with gcc:
|
|
%.expect :
|
|
(gcc $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe
|
|
|
|
# tell make not to delete
|
|
.PRECIOUS: %.expect
|
|
|
|
clean:
|
|
rm -vf fred.txt *.output a.exe
|