blob: a71f3c8744eabecd397401fe5698aaebe10b8652 [file] [log] [blame]
##===- 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)/Makefile.programs
.PRECIOUS: Output/%.linked.rll
ifndef USE_PRECOMPILED_BYTECODE
Output/%.linked.rbc: Output/%.ll
-$(LLVMAS) < $< > $@
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)