blob: e885eb99e82e73f7859736fc34f1f8961128ba1d [file] [log] [blame]
Chris Lattner9d014e72003-11-23 17:55:19 +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 = ../../..
Chris Lattner9d014e72003-11-23 17:55:19 +000011DIRS =
12
Reid Spencer64b5fb22004-10-28 06:42:34 +000013EXTRA_DIST = fibonacci.st hello.st prime.st goof.st
14
15SAMPLES = fibonacci hello prime goof
Chris Lattner9d014e72003-11-23 17:55:19 +000016
Reid Spencer6e039e52004-10-29 06:42:38 +000017LLVMC_EXEC = LLVM_CONFIG_DIR=$(BUILD_SRC_ROOT)/tools/llvmc $(TOOLDIR)/llvmc
Chris Lattner0c82ee72003-12-08 07:08:00 +000018
Brian Gaeke3e4a2712003-11-24 02:57:25 +000019all :: $(SAMPLES)
Chris Lattner9d014e72003-11-23 17:55:19 +000020
21ifdef OPTIMIZE
Reid Spencer6cb21d42004-10-27 23:18:45 +000022% : %.st
Reid Spencera98e7b52004-10-30 09:26:22 +000023 $(Echo) "Compiling and Optimizing $(<F)"
24 $(Verb)$(LLVMC_EXEC) -O3 $< -o $@
Chris Lattner9d014e72003-11-23 17:55:19 +000025else
Reid Spencere198cd12004-10-28 04:08:05 +000026% : %.st
Reid Spencera98e7b52004-10-30 09:26:22 +000027 $(Echo) "Compiling $(<F)"
28 $(Verb)$(LLVMC_EXEC) $< -o $@
Chris Lattner9d014e72003-11-23 17:55:19 +000029endif
30
Brian Gaeke3e4a2712003-11-24 02:57:25 +000031SAMPLES_LL = $(SAMPLES:%=%.ll)
32SAMPLES_BC = $(SAMPLES:%=%.bc)
33SAMPLES_S = $(SAMPLES:%=%.s)
34
35clean ::
Reid Spencera98e7b52004-10-30 09:26:22 +000036 $(Verb)rm -f gmon.out $(SAMPLES)
Chris Lattner9d014e72003-11-23 17:55:19 +000037#
38# Include the Master Makefile that knows how to build all.
39#
40include $(LEVEL)/Makefile.common