Chris Lattner | 9d014e7 | 2003-11-23 17:55:19 +0000 | [diff] [blame^] | 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 | TESTS = fibonacci hello prime |
| 18 | |
| 19 | all :: $(TESTS) |
| 20 | |
| 21 | ifdef OPTIMIZE |
| 22 | %.bc : %.st |
| 23 | stkrc -e -o - $< | opt -stats -q -f -o $*.bc \ |
| 24 | -aa-eval -adce -branch-combine -cee -constmerge -constprop -dce -die -ds-aa \ |
| 25 | -ds-opt -gcse -globaldce -indvars -inline -instcombine \ |
| 26 | -ipconstprop -licm -loopsimplify -mem2reg -pre -sccp -simplifycfg \ |
| 27 | -tailcallelim -verify |
| 28 | else |
| 29 | %.bc : %.st |
| 30 | stkrc -e -f -o $*.bc $< |
| 31 | endif |
| 32 | |
| 33 | %.s : %.bc |
| 34 | llc -f -o $*.s $< |
| 35 | |
| 36 | % : %.s |
| 37 | gcc -g -L$(BUILD_OBJ_ROOT)/lib/Debug -lstkr_runtime -o $* $*.s |
| 38 | |
| 39 | %.ll : %.bc |
| 40 | llvm-dis -f -o $*.ll $< |
| 41 | |
| 42 | %.bc : $(BUILD_OBJ_ROOT)/tools/Debug/stkrc |
| 43 | |
| 44 | .PRECIOUS: %.bc %.s %.ll %.st |
| 45 | # |
| 46 | # Include the Master Makefile that knows how to build all. |
| 47 | # |
| 48 | include $(LEVEL)/Makefile.common |