blob: c24d965f846f815125f6b9ad1bc665a6af0b6abb [file] [log] [blame]
##===- test/Programs/SingleSource/Makefile.singlesrc -------*- Makefile -*-===##
#
# This makefile builds all of the C programs in this directory in three
# different configurations:
# 1. By the native GCC compiler
# 2. To LLVM bytecode
# 3. To Sparc machine code, from bytecode, using LLC
#
# After building all of these different forms, the programs are run and the
# output is diff'd
#
# FIXME: There should be a way to specify libraries to link programs against
# FIXME: There should be a way to specify the command line for a program
#
# IDEA: This could be specified in the start of the .c file, in a comment block
#
##===----------------------------------------------------------------------===##
PROGRAMS_TO_TEST = $(patsubst $(SourceDir)%,%,$(basename $(Source)))
include $(LEVEL)/test/Programs/Makefile.programs
.PRECIOUS: Output/%.linked.rll
ifndef USE_PRECOMPILED_BYTECODE
Output/%.linked.rll: Output/%.ll
cp -f $< $@
Output/%.LOC.txt: $(SourceDir)/%.c
cat $< | wc -l > $@
Output/%.LOC.txt: $(SourceDir)/%.cpp
cat $< | wc -l > $@
endif
# FIXME: LIBS should be specified, not hardcoded to -lm
Output/%.native: $(SourceDir)/%.c Output/.dir
$(CC) $(CFLAGS) -O2 $< -lm -o $@ $(LDFLAGS)
Output/%.native: $(SourceDir)/%.cpp Output/.dir
$(CXX) $(CXXFLAGS) -O2 $< -lm -o $@ $(LDFLAGS)