blob: c7680dcaf55b3ae49b3c39e2e616de1e2e6163b7 [file] [log] [blame]
Chris Lattnere44f1db2003-11-23 18:12:22 +00001##===- projects/sample/Makefile ----------------------------*- Makefile -*-===##
2#
3# This is a sample Makefile for a project that uses LLVM.
4#
5##===----------------------------------------------------------------------===##
6
7#
8# Indicates our relative path to the top of the project's root directory.
9#
10LEVEL = ../../..
11
12#
13# Directories that needs to be built.
14#
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
34all :: test_each
35
36test_each: $(TESTS)
37 $(BUILD_SRC_DIR)/runtests $(BUILD_OBJ_DIR) $(TESTS)
38
39% : %.s testing.s
40 gcc -ggdb -L$(BUILD_OBJ_ROOT)/lib/Debug testing.s -lstkr_runtime -o $* $*.s
41
42%.s : %.bc
43 llc -f -o $*.s $<
44
45ifdef OPTIMIZE
46%.bc : %.st $(BUILD_OBJ_ROOT)/tools/Debug/stkrc
47 stkrc -e -o - $< | opt -stats -q -f -o $*.bc -adce -branch-combine -cee -constmerge -constprop -dce -die -gcse -globaldce -instcombine -pre
48else
49%.bc : %.st $(BUILD_OBJ_ROOT)/tools/Debug/stkrc
50 stkrc -e -f -o $*.bc $<
51endif
52
53%.ll : %.bc
54 llvm-dis -o $*.ll $<
55
56clean ::
57 rm -f $(TESTS)
58
59.SUFFIXES: .st .s .ll
60.PRECIOUS: %.s %.ll %.bc %.st
61.PHONY: test_each test_asm