Chris Lattner | e0d8daa | 2003-05-09 04:19:58 +0000 | [diff] [blame] | 1 | ##----------------------------------------------------------*- Makefile -*-===## |
Chris Lattner | 919937d | 2003-07-25 22:26:17 +0000 | [diff] [blame] | 2 | ## |
Chris Lattner | c89764e | 2002-01-22 16:56:41 +0000 | [diff] [blame] | 3 | ## Common rules for generating, linking, and compiling via LLVM. This is |
| 4 | ## used to implement a robust testing framework for LLVM |
Chris Lattner | 919937d | 2003-07-25 22:26:17 +0000 | [diff] [blame] | 5 | ## |
Chris Lattner | e0d8daa | 2003-05-09 04:19:58 +0000 | [diff] [blame] | 6 | ##-------------------------------------------------------------------------===## |
Vikram S. Adve | 977fa8d | 2001-12-15 01:13:42 +0000 | [diff] [blame] | 7 | |
Chris Lattner | 995663e | 2003-01-16 20:26:29 +0000 | [diff] [blame] | 8 | # If the user specified a TEST= option on the command line, we do not want to do |
| 9 | # the default testing type. Instead, we change the default target to be the |
| 10 | # test:: target. |
| 11 | # |
| 12 | ifdef TEST |
| 13 | test:: |
| 14 | endif |
| 15 | |
Chris Lattner | b8586b7 | 2003-08-22 14:09:46 +0000 | [diff] [blame] | 16 | # We do not want to make .d files for tests! |
| 17 | DISABLE_AUTO_DEPENDENCIES=1 |
| 18 | |
Vikram S. Adve | 977fa8d | 2001-12-15 01:13:42 +0000 | [diff] [blame] | 19 | include ${LEVEL}/Makefile.common |
| 20 | |
Chris Lattner | 37e6f70 | 2003-01-21 21:31:29 +0000 | [diff] [blame] | 21 | # Specify ENABLE_STATS on the command line to enable -stats and -time-passes |
| 22 | # output from gccas and gccld. |
Chris Lattner | 9551817 | 2002-09-30 19:23:55 +0000 | [diff] [blame] | 23 | ifdef ENABLE_STATS |
Chris Lattner | 37e6f70 | 2003-01-21 21:31:29 +0000 | [diff] [blame] | 24 | STATS = -stats -time-passes |
Chris Lattner | 9551817 | 2002-09-30 19:23:55 +0000 | [diff] [blame] | 25 | endif |
| 26 | |
Vikram S. Adve | 4cceffe | 2001-11-05 00:18:30 +0000 | [diff] [blame] | 27 | .PHONY: clean default |
| 28 | |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 29 | # These files, which might be intermediate results, should not be deleted by |
| 30 | # make |
| 31 | .PRECIOUS: Output/%.bc Output/%.ll |
| 32 | .PRECIOUS: Output/%.tbc Output/%.tll |
| 33 | .PRECIOUS: Output/.dir |
Chris Lattner | aef6546 | 2002-04-07 08:11:07 +0000 | [diff] [blame] | 34 | .PRECIOUS: Output/%.llvm.bc |
| 35 | .PRECIOUS: Output/%.llvm |
Vikram S. Adve | a46fb6b | 2001-11-06 17:09:49 +0000 | [diff] [blame] | 36 | |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 37 | LCCFLAGS += -O2 -Wall |
Chris Lattner | a9028e6 | 2003-05-13 20:06:00 +0000 | [diff] [blame] | 38 | LCXXFLAGS += -O2 -Wall |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 39 | LLCFLAGS = |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 40 | FAILURE = $(LLVM_SRC_ROOT)/test/Failure.sh |
Chris Lattner | 45983ee | 2003-06-28 22:35:46 +0000 | [diff] [blame] | 41 | TESTRUNR = @echo Running test: $<; \ |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 42 | PATH=$(LLVMTOOLCURRENT):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH) \ |
| 43 | $(LLVM_SRC_ROOT)/test/TestRunner.sh |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 44 | |
Sumant Kowshik | c961a29 | 2003-08-06 01:03:28 +0000 | [diff] [blame] | 45 | LLCLIBS := $(LLCLIBS) -lm |
Vikram S. Adve | 4cceffe | 2001-11-05 00:18:30 +0000 | [diff] [blame] | 46 | |
Vikram S. Adve | f9017b8 | 2002-08-30 03:27:36 +0000 | [diff] [blame] | 47 | clean:: |
Vikram S. Adve | 1239874 | 2003-07-08 18:39:51 +0000 | [diff] [blame] | 48 | $(RM) -f a.out core |
Chris Lattner | c89764e | 2002-01-22 16:56:41 +0000 | [diff] [blame] | 49 | $(RM) -rf Output/ |
Vikram S. Adve | 4cceffe | 2001-11-05 00:18:30 +0000 | [diff] [blame] | 50 | |
Chris Lattner | 6723add | 2002-02-12 15:39:38 +0000 | [diff] [blame] | 51 | # Compile from X.c to Output/X.ll |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 52 | Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES) |
Brian Gaeke | 5c59be9 | 2004-01-13 21:56:30 +0000 | [diff] [blame] | 53 | -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@ |
Chris Lattner | e5b27bd | 2001-12-09 16:55:43 +0000 | [diff] [blame] | 54 | |
Chris Lattner | a9028e6 | 2003-05-13 20:06:00 +0000 | [diff] [blame] | 55 | # Compile from X.cpp to Output/X.ll |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 56 | Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES) |
Brian Gaeke | 5c59be9 | 2004-01-13 21:56:30 +0000 | [diff] [blame] | 57 | -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@ |
Chris Lattner | a9028e6 | 2003-05-13 20:06:00 +0000 | [diff] [blame] | 58 | |
Chris Lattner | 707af6e | 2003-06-02 05:49:11 +0000 | [diff] [blame] | 59 | # Compile from X.cc to Output/X.ll |
John Criswell | ee29d2a | 2003-09-06 15:12:21 +0000 | [diff] [blame] | 60 | Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES) |
Brian Gaeke | 5c59be9 | 2004-01-13 21:56:30 +0000 | [diff] [blame] | 61 | -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@ |
Chris Lattner | 707af6e | 2003-06-02 05:49:11 +0000 | [diff] [blame] | 62 | |
Chris Lattner | 6723add | 2002-02-12 15:39:38 +0000 | [diff] [blame] | 63 | # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come |
| 64 | # from GCC output, so use GCCAS. |
| 65 | # |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 66 | Output/%.bc: Output/%.ll $(LGCCAS) |
Brian Gaeke | 844c546 | 2004-01-13 21:59:51 +0000 | [diff] [blame] | 67 | -$(LGCCAS) $(STATS) $< -o $@ |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 68 | |
Chris Lattner | 6723add | 2002-02-12 15:39:38 +0000 | [diff] [blame] | 69 | # LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from |
| 70 | # LLVM source, use the non-transforming assembler. |
| 71 | # |
Brian Gaeke | 5c59be9 | 2004-01-13 21:56:30 +0000 | [diff] [blame] | 72 | Output/%.bc: %.ll $(LLVMAS) Output/.dir |
| 73 | -$(LLVMAS) -f $< -o $@ |
Chris Lattner | 52a4e85 | 2002-01-23 21:36:59 +0000 | [diff] [blame] | 74 | |
Vikram S. Adve | a46fb6b | 2001-11-06 17:09:49 +0000 | [diff] [blame] | 75 | ## Cancel built-in implicit rules that override above rules |
Vikram S. Adve | 4cceffe | 2001-11-05 00:18:30 +0000 | [diff] [blame] | 76 | %: %.s |
| 77 | |
Vikram S. Adve | a46fb6b | 2001-11-06 17:09:49 +0000 | [diff] [blame] | 78 | %: %.c |
| 79 | |
| 80 | %.o: %.c |
| 81 | |