Makefile.tests 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ##----------------------------------------------------------*- Makefile -*-===##
  2. ##
  3. ## Common rules for generating, linking, and compiling via LLVM. This is
  4. ## used to implement a robust testing framework for LLVM
  5. ##
  6. ##-------------------------------------------------------------------------===##
  7. # If the user specified a TEST= option on the command line, we do not want to do
  8. # the default testing type. Instead, we change the default target to be the
  9. # test:: target.
  10. #
  11. ifdef TEST
  12. test::
  13. endif
  14. # We do not want to make .d files for tests!
  15. DISABLE_AUTO_DEPENDENCIES=1
  16. include ${LEVEL}/Makefile.common
  17. # Specify ENABLE_STATS on the command line to enable -stats and -time-passes
  18. # output from gccas and gccld.
  19. ifdef ENABLE_STATS
  20. STATS = -stats -time-passes
  21. endif
  22. .PHONY: clean default
  23. # These files, which might be intermediate results, should not be deleted by
  24. # make
  25. .PRECIOUS: Output/%.bc Output/%.ll
  26. .PRECIOUS: Output/%.tbc Output/%.tll
  27. .PRECIOUS: Output/.dir
  28. .PRECIOUS: Output/%.llvm.bc
  29. .PRECIOUS: Output/%.llvm
  30. LCCFLAGS += -O2 -Wall
  31. LCXXFLAGS += -O2 -Wall
  32. LLCFLAGS =
  33. TESTRUNR = @echo Running test: $<; \
  34. PATH="$(LLVMTOOLCURRENT):$(PATH)" \
  35. $(LLVM_SRC_ROOT)/test/TestRunner.sh
  36. LLCLIBS := $(LLCLIBS) -lm
  37. clean::
  38. $(RM) -f a.out core
  39. $(RM) -rf Output/
  40. # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come
  41. # from GCC output, so use GCCAS.
  42. #
  43. Output/%.bc: Output/%.ll $(LGCCAS)
  44. -$(LGCCAS) $(STATS) $< -o $@
  45. # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
  46. # LLVM source, use the non-transforming assembler.
  47. #
  48. Output/%.bc: %.ll $(LLVMAS) Output/.dir
  49. -$(LLVMAS) $< -o $@
  50. ## Cancel built-in implicit rules that override above rules
  51. %: %.s
  52. %: %.c
  53. %.o: %.c