blob: bb0ba05823ef3615968e78bd09c2583007194253 [file] [log] [blame]
Reid Spencer39dcf0e2004-09-04 20:13:54 +00001##===- projects/Stacker/test/Makefile ----------------------*- Makefile -*-===##
Chris Lattnere44f1db2003-11-23 18:12:22 +00002#
Reid Spencer39dcf0e2004-09-04 20:13:54 +00003# This is the makefile that tests the various facilities of the Stacker language
Chris Lattnere44f1db2003-11-23 18:12:22 +00004#
5##===----------------------------------------------------------------------===##
6
7#
8# Indicates our relative path to the top of the project's root directory.
9#
Reid Spencer39dcf0e2004-09-04 20:13:54 +000010LEVEL = ../
Chris Lattnere44f1db2003-11-23 18:12:22 +000011
12#
Reid Spencer39dcf0e2004-09-04 20:13:54 +000013# Directories that need to be built.
Chris Lattnere44f1db2003-11-23 18:12:22 +000014#
15DIRS =
16
17#
18# Include the Master Makefile that knows how to build all.
19#
20include $(LEVEL)/Makefile.common
21
22LOGIC_TESTS = eq ne le ge gt lt false true
23BITWISE_TESTS = shl shr xor or and
24ARITHMETIC_TESTS = abs neg add sub mul div mod star_slash incr decr min max
25STACK_TESTS = drop drop2 nip nip2 dup dup2 swap swap2 over over2 rot rot2 \
26 rrot rrot2 tuck tuck2 roll pick select
27MEMORY_TESTS = memory
28CONTROL_TESTS = while return
29IO_TESTS = space tab out_chr out_num out_str
30
31TESTS = $(LOGIC_TESTS) $(ARITHMETIC_TESTS) $(BITWISE_TESTS) $(STACK_TESTS) \
32 $(MEMORY_TESTS) $(CONTROL_TESTS) $(IO_TESTS)
33
Reid Spencer150e8422004-11-20 21:03:34 +000034LLVMC = $(LLVMToolDir)/llvmc
Chris Lattner0c82ee72003-12-08 07:08:00 +000035
Chris Lattnere44f1db2003-11-23 18:12:22 +000036all :: test_each
37
38test_each: $(TESTS)
Reid Spencer3abd4972004-10-30 09:25:27 +000039 $(Echo) "Running Tests..."
Reid Spencerf1e6e842005-02-14 16:04:28 +000040 $(Verb) LD_LIBRARY_PATH=$(PROJ_OBJ_ROOT)/lib/$(CONFIGURATION) \
41 $(PROJ_SRC_DIR)/runtests $(PROJ_OBJ_DIR) $(TESTS)
Chris Lattnere44f1db2003-11-23 18:12:22 +000042
Reid Spencer150e8422004-11-20 21:03:34 +000043% : %.st Makefile testing.bc
44 $(Echo) "Building $*"
Reid Spencer59784852004-12-05 05:18:28 +000045 $(Verb)$(LLVMC) -O4 -o $@ $< testing.bc $(LibDir)/stkr_runtime.bc -lcrtend
Chris Lattnere44f1db2003-11-23 18:12:22 +000046
Reid Spencer150e8422004-11-20 21:03:34 +000047testing.bc : testing.st Makefile
48 $(Echo) "Compiling $*"
49 $(Verb)$(LLVMC) -O3 -c -o $@ $<
Brian Gaeke3e4a2712003-11-24 02:57:25 +000050
51TESTS_LL = $(TESTS:%=%.ll)
52TESTS_BC = $(TESTS:%=%.bc)
53TESTS_S = $(TESTS:%=%.s)
Chris Lattnere44f1db2003-11-23 18:12:22 +000054
55clean ::
Reid Spencer150e8422004-11-20 21:03:34 +000056 $(Verb)rm -f gmon.out $(TESTS_LL) $(TESTS_BC) $(TESTS_S) $(TESTS) \
57 testing.bc testing.s testing.ll
Chris Lattnere44f1db2003-11-23 18:12:22 +000058
Brian Gaeke3e4a2712003-11-24 02:57:25 +000059.SUFFIXES: .st .s .ll .bc
Chris Lattnere44f1db2003-11-23 18:12:22 +000060.PRECIOUS: %.s %.ll %.bc %.st
Brian Gaeke3e4a2712003-11-24 02:57:25 +000061.PHONY: test_each