da74872ec2b546052a34fb5a528d90b912e8b8ca
[oota-llvm.git] / projects / Stacker / test / Makefile
1 ##===- projects/Stacker/test/Makefile ----------------------*- Makefile -*-===##
2 #
3 # This is the makefile that tests the various facilities of the Stacker language
4 #
5 ##===----------------------------------------------------------------------===##
6
7 #
8 # Indicates our relative path to the top of the project's root directory.
9 #
10 LEVEL = ../
11
12 #
13 # Directories that need to be built.
14 #
15 DIRS =
16
17 #
18 # Include the Master Makefile that knows how to build all.
19 #
20 include $(LEVEL)/Makefile.common
21
22 LOGIC_TESTS = eq ne le ge gt lt false true
23 BITWISE_TESTS = shl shr xor or and
24 ARITHMETIC_TESTS = abs neg add sub mul div mod star_slash incr decr min max 
25 STACK_TESTS = drop drop2 nip nip2 dup dup2 swap swap2 over over2 rot rot2 \
26               rrot rrot2 tuck tuck2 roll pick select
27 MEMORY_TESTS = memory
28 CONTROL_TESTS = while return 
29 IO_TESTS = space tab out_chr out_num out_str
30
31 TESTS = $(LOGIC_TESTS) $(ARITHMETIC_TESTS) $(BITWISE_TESTS) $(STACK_TESTS) \
32         $(MEMORY_TESTS) $(CONTROL_TESTS) $(IO_TESTS)
33
34 STKRC_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/stkrc
35
36 all :: test_each
37
38 test_each: $(TESTS)
39         @$(ECHO) "Running Tests..."
40         $(VERB) LD_LIBRARY_PATH=$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) $(BUILD_SRC_DIR)/runtests $(BUILD_OBJ_DIR) $(TESTS) 
41
42 %.bc : %.st Makefile
43         @$(ECHO) "Compiling And Optimizing $< to $*.bc"
44         $(VERB)$(STKRC_EXEC) -f -O4 -s 2048 -o $*.bc $(BUILD_SRC_DIR)/$*.st
45
46 %.s : %.bc testing.bc
47         @$(ECHO) "Assembling $< to $*.s"
48         $(VERB)$(LLINK) $*.bc testing.bc -o $*.bcl
49         $(VERB)$(LLC) -f -o $*.s $*.bcl
50
51 % : %.s
52         @$(ECHO) "Linking $*"
53         $(VERB)$(CC) -ggdb -L$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) -lstkr_runtime -o $* $*.s
54
55 %.ll : %.bc
56         @$(ECHO) "Disassembling $< to $*.ll"
57         $(VERB)$(LDIS) -dis -o $*.ll $<
58
59 TESTS_LL = $(TESTS:%=%.ll)
60 TESTS_BC = $(TESTS:%=%.bc)
61 TESTS_S  = $(TESTS:%=%.s)
62
63 clean :: 
64         $(VERB)rm -f gmon.out $(TESTS_LL) $(TESTS_BC) $(TESTS_S) $(TESTS) testing.bc testing.s testing.ll
65
66 .SUFFIXES: .st .s .ll .bc
67 .PRECIOUS: %.s %.ll %.bc %.st
68 .PHONY: test_each