This pass is not needed, as there is only ever one global: the stack
[oota-llvm.git] / projects / Stacker / samples / Makefile
1 ##===- 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 #
10 LEVEL = ../../..
11
12 #
13 # Directories that needs to be built.
14 #
15 DIRS = 
16
17 SAMPLES = fibonacci hello prime
18
19 LLC_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/llc
20 OPT_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/opt
21 STKRC_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/stkrc
22 LLVMDIS_EXEC = $(BUILD_OBJ_ROOT)/tools/$(CONFIGURATION)/llvm-dis
23
24 all :: $(SAMPLES)
25
26 ifdef OPTIMIZE
27 %.bc : %.st 
28         @$(ECHO) "Compiling and Optimizing $< to $*.bc"
29         $(VERB)$(STKRC_EXEC) -e -o - $< | opt -stats -q -f -o $*.bc \
30             -aa-eval -adce -branch-combine -cee -constmerge -constprop -dce -die -ds-aa \
31             -ds-opt -gcse -globaldce -indvars -inline -instcombine \
32             -ipconstprop -licm -loopsimplify -mem2reg -pre -sccp -simplifycfg \
33             -tailcallelim -verify
34 else
35 %.bc : %.st
36         @$(ECHO) "Compiling $< to $*.bc"
37         $(VERB)$(STKRC_EXEC) -e -f -o $*.bc $< 
38 endif
39
40 %.s : %.bc
41         @$(ECHO) "Compiling $< to $*.s"
42         $(VERB)$(LLC_EXEC) -f -o $*.s $<
43
44 % : %.s
45         @$(ECHO) "Compiling and Linking $< to $*"
46         $(VERB)gcc -g -L$(BUILD_OBJ_ROOT)/lib/$(CONFIGURATION) -lstkr_runtime -o $* $*.s
47
48 %.ll : %.bc
49         @$(ECHO) "Disassembling $< to $*.ll"
50         $(VERB)$(LLVMDIS_EXEC) -f -o $*.ll $<
51
52 %.bc :  $(STKRC_EXEC)
53
54 .PRECIOUS: %.bc %.s %.ll %.st
55
56 SAMPLES_LL = $(SAMPLES:%=%.ll)
57 SAMPLES_BC = $(SAMPLES:%=%.bc)
58 SAMPLES_S  = $(SAMPLES:%=%.s)
59
60 clean ::
61         $(VERB)rm -f gmon.out $(SAMPLES_LL) $(SAMPLES_BC) $(SAMPLES_S) $(SAMPLES)
62 #
63 # Include the Master Makefile that knows how to build all.
64 #
65 include $(LEVEL)/Makefile.common