Chris Lattner | e70efc6 | 2003-05-17 22:32:15 +0000 | [diff] [blame] | 1 | ##===- test/Programs/SingleSource/Makefile.singlesrc -------*- Makefile -*-===## |
Chris Lattner | 35db8d6 | 2001-12-14 16:13:40 +0000 | [diff] [blame] | 2 | # |
| 3 | # This makefile builds all of the C programs in this directory in three |
| 4 | # different configurations: |
| 5 | # 1. By the native GCC compiler |
| 6 | # 2. To LLVM bytecode |
| 7 | # 3. To Sparc machine code, from bytecode, using LLC |
| 8 | # |
| 9 | # After building all of these different forms, the programs are run and the |
| 10 | # output is diff'd |
| 11 | # |
| 12 | # FIXME: There should be a way to specify libraries to link programs against |
Chris Lattner | 35db8d6 | 2001-12-14 16:13:40 +0000 | [diff] [blame] | 13 | # FIXME: There should be a way to specify the command line for a program |
| 14 | # |
| 15 | # IDEA: This could be specified in the start of the .c file, in a comment block |
| 16 | # |
Chris Lattner | f7e6612 | 2003-01-21 21:32:03 +0000 | [diff] [blame] | 17 | ##===----------------------------------------------------------------------===## |
Chris Lattner | 35db8d6 | 2001-12-14 16:13:40 +0000 | [diff] [blame] | 18 | |
John Criswell | 81bcc3a | 2003-09-06 15:13:45 +0000 | [diff] [blame] | 19 | PROGRAMS_TO_TEST = $(patsubst $(SourceDir)%,%,$(basename $(Source))) |
Chris Lattner | 35db8d6 | 2001-12-14 16:13:40 +0000 | [diff] [blame] | 20 | |
Chris Lattner | 9e37936 | 2002-01-22 15:31:59 +0000 | [diff] [blame] | 21 | include $(LEVEL)/test/Programs/Makefile.programs |
Chris Lattner | f7e6612 | 2003-01-21 21:32:03 +0000 | [diff] [blame] | 22 | .PRECIOUS: Output/%.linked.rll |
| 23 | |
Chris Lattner | adac87c | 2003-01-23 03:52:03 +0000 | [diff] [blame] | 24 | ifndef USE_PRECOMPILED_BYTECODE |
Chris Lattner | f7e6612 | 2003-01-21 21:32:03 +0000 | [diff] [blame] | 25 | Output/%.linked.rll: Output/%.ll |
| 26 | cp -f $< $@ |
Chris Lattner | 7af9aa0 | 2003-02-15 00:30:44 +0000 | [diff] [blame] | 27 | |
John Criswell | 81bcc3a | 2003-09-06 15:13:45 +0000 | [diff] [blame] | 28 | Output/%.LOC.txt: $(SourceDir)/%.c |
Chris Lattner | 7af9aa0 | 2003-02-15 00:30:44 +0000 | [diff] [blame] | 29 | cat $< | wc -l > $@ |
John Criswell | 81bcc3a | 2003-09-06 15:13:45 +0000 | [diff] [blame] | 30 | Output/%.LOC.txt: $(SourceDir)/%.cpp |
Chris Lattner | 0ce5e5b | 2003-06-16 15:50:51 +0000 | [diff] [blame] | 31 | cat $< | wc -l > $@ |
Chris Lattner | adac87c | 2003-01-23 03:52:03 +0000 | [diff] [blame] | 32 | endif |
Chris Lattner | 35db8d6 | 2001-12-14 16:13:40 +0000 | [diff] [blame] | 33 | |
Chris Lattner | c405ea2 | 2002-01-23 05:51:44 +0000 | [diff] [blame] | 34 | # FIXME: LIBS should be specified, not hardcoded to -lm |
John Criswell | 81bcc3a | 2003-09-06 15:13:45 +0000 | [diff] [blame] | 35 | Output/%.native: $(SourceDir)/%.c Output/.dir |
John Criswell | 4046a24 | 2003-12-08 22:59:06 +0000 | [diff] [blame] | 36 | $(CC) $(CFLAGS) -O2 $< -lm -o $@ $(LDFLAGS) |
John Criswell | 81bcc3a | 2003-09-06 15:13:45 +0000 | [diff] [blame] | 37 | Output/%.native: $(SourceDir)/%.cpp Output/.dir |
John Criswell | 4046a24 | 2003-12-08 22:59:06 +0000 | [diff] [blame] | 38 | $(CXX) $(CXXFLAGS) -O2 $< -lm -o $@ $(LDFLAGS) |