blob: d750aad4ac437c4fde2cd6cec98ca1eda1117831 [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/%.bc
-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) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
Output/%.native: $(SourceDir)/%.cpp Output/.dir
-$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(OPTFLAGS) $(TARGET_FLAGS) $< -lm -o $@ $(LDFLAGS)
bugpoint-gccas bugpoint-opt bugpoint-llvm-ld bugpoint-gccld bugpoint-jit bugpoint-llc bugpoint-llc-beta:
@echo "The $@ target doesn't work in SingleSource. Try:"
@echo " 'make Output/[programname].$@' instead."