blob: c24d965f846f815125f6b9ad1bc665a6af0b6abb [file] [log] [blame]
Chris Lattnere70efc62003-05-17 22:32:15 +00001##===- test/Programs/SingleSource/Makefile.singlesrc -------*- Makefile -*-===##
Chris Lattner35db8d62001-12-14 16:13:40 +00002#
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 Lattner35db8d62001-12-14 16:13:40 +000013# 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 Lattnerf7e66122003-01-21 21:32:03 +000017##===----------------------------------------------------------------------===##
Chris Lattner35db8d62001-12-14 16:13:40 +000018
John Criswell81bcc3a2003-09-06 15:13:45 +000019PROGRAMS_TO_TEST = $(patsubst $(SourceDir)%,%,$(basename $(Source)))
Chris Lattner35db8d62001-12-14 16:13:40 +000020
Chris Lattner9e379362002-01-22 15:31:59 +000021include $(LEVEL)/test/Programs/Makefile.programs
Chris Lattnerf7e66122003-01-21 21:32:03 +000022.PRECIOUS: Output/%.linked.rll
23
Chris Lattneradac87c2003-01-23 03:52:03 +000024ifndef USE_PRECOMPILED_BYTECODE
Chris Lattnerf7e66122003-01-21 21:32:03 +000025Output/%.linked.rll: Output/%.ll
26 cp -f $< $@
Chris Lattner7af9aa02003-02-15 00:30:44 +000027
John Criswell81bcc3a2003-09-06 15:13:45 +000028Output/%.LOC.txt: $(SourceDir)/%.c
Chris Lattner7af9aa02003-02-15 00:30:44 +000029 cat $< | wc -l > $@
John Criswell81bcc3a2003-09-06 15:13:45 +000030Output/%.LOC.txt: $(SourceDir)/%.cpp
Chris Lattner0ce5e5b2003-06-16 15:50:51 +000031 cat $< | wc -l > $@
Chris Lattneradac87c2003-01-23 03:52:03 +000032endif
Chris Lattner35db8d62001-12-14 16:13:40 +000033
Chris Lattnerc405ea22002-01-23 05:51:44 +000034# FIXME: LIBS should be specified, not hardcoded to -lm
John Criswell81bcc3a2003-09-06 15:13:45 +000035Output/%.native: $(SourceDir)/%.c Output/.dir
John Criswell4046a242003-12-08 22:59:06 +000036 $(CC) $(CFLAGS) -O2 $< -lm -o $@ $(LDFLAGS)
John Criswell81bcc3a2003-09-06 15:13:45 +000037Output/%.native: $(SourceDir)/%.cpp Output/.dir
John Criswell4046a242003-12-08 22:59:06 +000038 $(CXX) $(CXXFLAGS) -O2 $< -lm -o $@ $(LDFLAGS)