1 ##===- projects/sample/Makefile ----------------------------*- Makefile -*-===##
3 # This is a sample Makefile for a project that uses LLVM.
5 ##===----------------------------------------------------------------------===##
8 # Indicates our relative path to the top of the project's root directory.
13 # Directories that needs to be built.
17 SAMPLES = fibonacci hello prime
23 @$(ECHO) "Compiling and Optimizing $< to $*.bc"
24 $(VERB)stkrc -e -o - $< | opt -stats -q -f -o $*.bc \
25 -aa-eval -adce -branch-combine -cee -constmerge -constprop -dce -die -ds-aa \
26 -ds-opt -gcse -globaldce -indvars -inline -instcombine \
27 -ipconstprop -licm -loopsimplify -mem2reg -pre -sccp -simplifycfg \
31 @$(ECHO) "Compiling $< to $*.bc"
32 $(VERB)stkrc -e -f -o $*.bc $<
36 @$(ECHO) "Compiling $< to $*.s"
37 $(VERB)llc -f -o $*.s $<
40 @$(ECHO) "Compiling and Linking $< to $*"
41 $(VERB)gcc -g -L$(BUILD_OBJ_ROOT)/lib/Debug -lstkr_runtime -o $* $*.s
44 @$(ECHO) "Disassembling $< to $*.ll"
45 $(VERB)llvm-dis -f -o $*.ll $<
47 %.bc : $(BUILD_OBJ_ROOT)/tools/Debug/stkrc
49 .PRECIOUS: %.bc %.s %.ll %.st
51 SAMPLES_LL = $(SAMPLES:%=%.ll)
52 SAMPLES_BC = $(SAMPLES:%=%.bc)
53 SAMPLES_S = $(SAMPLES:%=%.s)
56 $(VERB)rm -f gmon.out $(SAMPLES_LL) $(SAMPLES_BC) $(SAMPLES_S) $(SAMPLES)
58 # Include the Master Makefile that knows how to build all.
60 include $(LEVEL)/Makefile.common