Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. TOP = ../..
  2. include $(TOP)/Makefile
  3.  
  4. # clear CFLAGS and LDFLAGS
  5. CFLAGS :=
  6. LDFLAGS :=
  7.  
  8. ifdef CONFIG_WIN32
  9.  TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
  10. else
  11.  TCCFLAGS = -B$(TOP) -I$(top_srcdir)/include -lm
  12. endif
  13.  
  14. ifeq ($(TARGETOS),Darwin)
  15.  CFLAGS += -Wl,-flat_namespace,-undefined,warning
  16.  TCCFLAGS += -D_ANSI_SOURCE
  17.  export MACOSX_DEPLOYMENT_TARGET:=10.2
  18. endif
  19.  
  20. TCC = $(TOP)/tcc $(TCCFLAGS)
  21.  
  22. TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c)))
  23.  
  24. # 34_array_assignment.test -- array assignment is not in C standard
  25. SKIP = 34_array_assignment.test
  26.  
  27. # some tests do not pass on all platforms, remove them for now
  28. ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
  29.  SKIP += 22_floating_point.test
  30. endif
  31. ifeq ($(TARGETOS),Darwin)
  32.  SKIP += 40_stdio.test
  33. endif
  34. ifdef CONFIG_WIN32
  35.  SKIP += 24_math_library.test # don't have round()
  36.  SKIP += 28_strings.test # don't have r/index() / strings.h
  37. endif
  38. ifeq ($(ARCH),x86-64)
  39.  SKIP += 73_arm64.test
  40. endif
  41.  
  42. # Some tests might need arguments
  43. ARGS =
  44. 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
  45. 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
  46.  
  47. # Some tests might need different flags
  48. FLAGS =
  49. 76_dollars_in_identifiers.test : FLAGS = -fdollars-in-identifiers
  50.  
  51. # Filter some always-warning
  52. FILTER =
  53. ifeq (-$(findstring arm,$(ARCH))-,-arm-)
  54. FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported'
  55. endif
  56.  
  57. all test: $(filter-out $(SKIP),$(TESTS))
  58.  
  59. %.test: %.c %.expect
  60.         @echo Test: $*...
  61. # test -run
  62.         @$(TCC) $(FLAGS) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true
  63.         @diff -Nbu $*.expect $*.output && rm -f $*.output
  64. # test exe (disabled for speed)
  65. #        @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \
  66. #            diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe
  67.  
  68. # automatically generate .expect files with gcc:
  69. %.expect :
  70.         (gcc $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe
  71.  
  72. # tell make not to delete
  73. .PRECIOUS: %.expect
  74.  
  75. clean:
  76.         rm -vf fred.txt *.output a.exe
  77.