##==- MultiSource/Makefile.multisrc ------------------------*- Makefile -*-===## # # This makefile should be used by subdirectories that have multiple source files # to be linked together. This contains all of the common makefile code required # to link an application together based on the $(Source) variable. # # Variables to be defined before including this makefile: # # 1. LEVEL - Must be set as per normal semantics: The depth from the top of tree # ##===----------------------------------------------------------------------===## LCCFLAGS := $(CFLAGS) $(CPPFLAGS) PROGRAMS_TO_TEST := $(PROG) ## LLVM bytecode libraries that must be linked with an application # FIXME: LIBS SHOULD BE SPECIFIED LIBS += -lm include $(LEVEL)/Makefile.programs # Figure out what object files we want to build... LObjs := $(sort $(addsuffix .bc, $(notdir $(basename $(Source))))) LObjects := $(addprefix Output/,$(LObjs)) NObjs := $(sort $(addsuffix .o, $(notdir $(basename $(Source))))) NObjects := $(addprefix Output/,$(NObjs)) .PRECIOUS: $(LObjects) $(NObjects) Output/%.o: %.c Output/.dir -$(CC) $(CPPFLAGS) $(CFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@ Output/%.o: %.C Output/.dir -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@ Output/%.o: %.cpp Output/.dir -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@ Output/%.o: %.cc Output/.dir -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_FLAGS) -c $< -o $@ bugpoint-opt: Output/$(PROG).bugpoint-opt bugpoint-gccas: Output/$(PROG).bugpoint-opt bugpoint-llvm-ld: Output/$(PROG).bugpoint-llvm-ld bugpoint-gccld: Output/$(PROG).bugpoint-llvm-ld bugpoint-jit: Output/$(PROG).bugpoint-jit bugpoint-llc: Output/$(PROG).bugpoint-llc bugpoint-llc-beta: Output/$(PROG).bugpoint-llc-beta bugpoint-cbe: Output/$(PROG).bugpoint-cbe misopt: Output/$(PROG).misopt.out ifndef USE_PRECOMPILED_BYTECODE $(PROGRAMS_TO_TEST:%=Output/%.linked.rbc): \ Output/%.linked.rbc: $(LObjects) $(LLVMLDPROG) -$(LLVMLDPROG) -link-as-library -disable-opt $(LObjects) -o $@ $(PROGRAMS_TO_TEST:%=Output/%.LOC.txt): \ Output/%.LOC.txt: $(Source) cat $^ $(wildcard $(SourceDir)/*.h) | wc -l > $@ endif Output/%.native: $(NObjects) -$(CXX) -o $@ $(NObjects) $(LDFLAGS) $(CFLAGS) $(TARGET_FLAGS) # A simple target to run findmisopt when bugpoint isn't helping findmisopt: $(LLVM_SRC_ROOT)/utils/findmisopt Output/$(PROG).linked.rbc misopt "$(RUN_OPTIONS)" "$(STDIN_FILENAME)"