mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Updated to find source files using VPATH. This makes writing build rules
much cleaner and easier. Labeled .td as a suffix for tblgen files in Makefile.rules. Modified build rules so that source files generated during the build are placed in the build directory and not the source directory (and not in a Debug directory). This makes the system cleaner and allows us to have a read-only source tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+17
-17
@@ -100,7 +100,7 @@ prdirs::
|
||||
###########################################################################
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .cpp .h .hpp .y .l
|
||||
.SUFFIXES: .lo .o .a .so .bc
|
||||
.SUFFIXES: .lo .o .a .so .bc .td
|
||||
.SUFFIXES: .ps .dot .d
|
||||
|
||||
#
|
||||
@@ -344,13 +344,13 @@ AR = ${AR_PATH} cq
|
||||
# The local Makefile can list other Source files via ExtraSource = ...
|
||||
#
|
||||
ifndef Source
|
||||
Source := $(ExtraSource) $(wildcard $(SourceDir)/*.cpp $(SourceDir)/*.c $(SourceDir)/*.y $(SourceDir)/*.l)
|
||||
Source := $(notdir $(ExtraSource) $(wildcard $(SourceDir)/*.cpp $(SourceDir)/*.c $(SourceDir)/*.y $(SourceDir)/*.l))
|
||||
endif
|
||||
|
||||
#
|
||||
# Libtool Objects
|
||||
#
|
||||
Srcs := $(sort $(notdir $(basename $(Source))))
|
||||
Srcs := $(sort $(basename $(Source)))
|
||||
Objs := $(addsuffix .lo, $(Srcs))
|
||||
ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs))
|
||||
ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
|
||||
@@ -360,7 +360,7 @@ ObjectsBC := $(addprefix $(BUILD_OBJ_DIR)/Bytecode/,$(addsuffix .bc, $(Srcs)))
|
||||
#
|
||||
# The real objects underlying the libtool objects
|
||||
#
|
||||
RObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(notdir $(basename $(Source))))))
|
||||
RObjs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source)))))
|
||||
RObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(RObjs))
|
||||
RObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(RObjs))
|
||||
RObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(RObjs))
|
||||
@@ -641,39 +641,39 @@ endif
|
||||
.PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
|
||||
|
||||
# Create .lo files in the ObjectFiles directory from the .cpp and .c files...
|
||||
$(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Release/.dir
|
||||
$(BUILD_OBJ_DIR)/Release/%.lo: %.cpp $(BUILD_OBJ_DIR)/Release/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileO) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Release/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Release/.dir
|
||||
$(BUILD_OBJ_DIR)/Release/%.lo: %.c $(BUILD_OBJ_DIR)/Release/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileCO) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Profile/.dir
|
||||
$(BUILD_OBJ_DIR)/Profile/%.lo: %.cpp $(BUILD_OBJ_DIR)/Profile/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileP) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Profile/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Profile/.dir
|
||||
$(BUILD_OBJ_DIR)/Profile/%.lo: %.c $(BUILD_OBJ_DIR)/Profile/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileCP) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Debug/.dir
|
||||
$(BUILD_OBJ_DIR)/Debug/%.lo: %.cpp $(BUILD_OBJ_DIR)/Debug/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileG) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Debug/%.lo: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Debug/.dir
|
||||
$(BUILD_OBJ_DIR)/Debug/%.lo: %.c $(BUILD_OBJ_DIR)/Debug/.dir
|
||||
@echo "Compiling $<"
|
||||
$(VERB) $(CompileCG) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
|
||||
@echo "Compiling $< to bytecode"
|
||||
$(VERB) $(LLVMGXX) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
|
||||
@echo "Compiling $< to bytecode"
|
||||
$(VERB) $(LLVMGCC) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)/%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
|
||||
$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
|
||||
@echo "Compiling $< to bytecode"
|
||||
$(VERB) $(LLVMAS) $< -f -o $@
|
||||
|
||||
@@ -712,7 +712,7 @@ YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
|
||||
%.h: %.y # Cancel built-in rules for yacc
|
||||
%.cpp %.h : %.y
|
||||
@echo Bison\'ing $<...
|
||||
$(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) $*.y
|
||||
$(VERB) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
|
||||
$(VERB) cmp -s $*.tab.c $*.cpp > /dev/null || ${MV} -f $*.tab.c $*.cpp
|
||||
$(VERB) cmp -s $*.tab.h $*.h > /dev/null || ${MV} -f $*.tab.h $*.h
|
||||
@# If the files were not updated, don't leave them lying around...
|
||||
@@ -758,15 +758,15 @@ ifndef DISABLE_AUTO_DEPENDENCIES
|
||||
# If dependencies were generated for the file that included this file,
|
||||
# include the dependencies now...
|
||||
#
|
||||
SourceBaseNames := $(basename $(notdir $(filter-out $(SourceDir)/$(CONFIGURATION)/%, $(Source))))
|
||||
SourceBaseNames := $(basename $(Source))
|
||||
SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
|
||||
|
||||
# Create dependencies for the *.cpp files...
|
||||
$(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)/%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
$(BUILD_OBJ_DIR)/Depend/%.d: %.cpp $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
$(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
|
||||
|
||||
# Create dependencies for the *.c files...
|
||||
$(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)/%.c $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
$(BUILD_OBJ_DIR)/Depend/%.d: %.c $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
$(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
|
||||
|
||||
#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
LEVEL = ../../..
|
||||
LIBRARYNAME = sparc
|
||||
|
||||
ExtraSource = Debug/Sparc.burm.cpp
|
||||
ExtraSource = Sparc.burm.cpp
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
@@ -11,22 +11,23 @@ else
|
||||
DEBUG_FLAG = -D_DEBUG
|
||||
endif
|
||||
|
||||
Debug/Sparc.burg.in1 : $(SourceDir)/Sparc.burg.in Debug/.dir
|
||||
Sparc.burg.in1 : Sparc.burg.in
|
||||
$(CXX) -E -I$(LLVM_SRC_ROOT)/include $(DEBUG_FLAG) -x c++ $< | ${SED} '/^# /d' | ${SED} 's/Ydefine/#define/' > $@
|
||||
|
||||
Debug/Sparc.burm : Debug/Sparc.burg.in1
|
||||
Sparc.burm : Sparc.burg.in1
|
||||
$(CXX) -E -I$(LLVM_SRC_ROOT)/include $(DEBUG_FLAG) -x c++ $< | ${SED} '/^# /d' | ${SED} 's/Xinclude/#include/g' | ${SED} 's/Xdefine/#define/g' > $@
|
||||
|
||||
Debug/Sparc.burm.cpp: Debug/Sparc.burm Debug/.dir
|
||||
Sparc.burm.cpp: Sparc.burm
|
||||
@echo "Burging $<"
|
||||
$(RunBurg) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Debug/Sparc.burm.lo: Debug/Sparc.burm.cpp
|
||||
$(BUILD_OBJ_DIR)/Debug/Sparc.burm.lo: Sparc.burm.cpp
|
||||
$(CompileG) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Release/Sparc.burm.lo: Debug/Sparc.burm.cpp
|
||||
$(BUILD_OBJ_DIR)/Release/Sparc.burm.lo: Sparc.burm.cpp
|
||||
$(CompileO) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Profile/Sparc.burm.lo: Debug/Sparc.burm.cpp
|
||||
$(BUILD_OBJ_DIR)/Profile/Sparc.burm.lo: Sparc.burm.cpp
|
||||
$(CompileP) $< -o $@
|
||||
|
||||
$(BUILD_OBJ_DIR)/Depend/Sparc.burm.d: $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
@@ -34,12 +35,14 @@ $(BUILD_OBJ_DIR)/Depend/Sparc.burm.d: $(BUILD_OBJ_DIR)/Depend/.dir
|
||||
|
||||
TARGET_NAME := SparcV9
|
||||
|
||||
TABLEGEN_FILES := $(wildcard $(SourceDir)/*.td)
|
||||
TABLEGEN_FILES := $(notdir $(wildcard $(SourceDir)/*.td))
|
||||
|
||||
$(SourceDir)/$(TARGET_NAME)CodeEmitter.cpp:: $(TARGET_NAME)CodeEmitter.inc
|
||||
|
||||
$(TARGET_NAME)CodeEmitter.inc:: $(TABLEGEN_FILES) $(TBLGEN)
|
||||
@echo "Tblgen'ing $(TARGET_NAME).td"
|
||||
$(TBLGEN) -I $(SourceDir) $(SourceDir)/$(TARGET_NAME).td -gen-emitter -o $@
|
||||
|
||||
clean::
|
||||
${RM} -f $(TARGET_NAME)CodeEmitter.inc
|
||||
${RM} -f $(TARGET_NAME)CodeEmitter.inc Sparc.burg.in1 Sparc.burm Sparc.burm.cpp
|
||||
|
||||
|
||||
@@ -8,21 +8,27 @@ $(SourceDepend): X86GenRegisterInfo.h.inc X86GenRegisterNames.inc \
|
||||
X86GenInstrInfo.inc X86GenInstrSelector.inc
|
||||
|
||||
X86GenRegisterNames.inc:: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-enums -o $@
|
||||
|
||||
X86GenRegisterInfo.h.inc:: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc-header -o $@
|
||||
|
||||
X86GenRegisterInfo.inc:: X86.td X86RegisterInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-register-desc -o $@
|
||||
|
||||
X86GenInstrNames.inc:: X86.td X86InstrInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-enums -o $@
|
||||
|
||||
X86GenInstrInfo.inc:: X86.td X86InstrInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-desc -o $@
|
||||
|
||||
X86GenInstrSelector.inc:: X86.td X86InstrInfo.td ../Target.td $(TBLGEN)
|
||||
@echo "Tblgen'ing $<"
|
||||
$(TBLGEN) -I $(BUILD_SRC_DIR) $< -gen-instr-selector -o $@
|
||||
|
||||
clean::
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
LEVEL = ../..
|
||||
TOOLNAME = burg
|
||||
ExtraSource = $(SourceDir)/gram.tab.c
|
||||
ExtraSource = gram.tab.c
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
VPATH=$(SourceDir)
|
||||
gram.tab.c gram.tab.h:: gram.yc
|
||||
$(VERB) $(BISON) -o gram.tab.c -d $<
|
||||
|
||||
$(SourceDir)/gram.tab.c $(SourceDir)/gram.tab.h:: gram.yc
|
||||
$(VERB) $(BISON) -o $(SourceDir)/gram.tab.c -d $<
|
||||
|
||||
$(SourceDir)/lex.c: $(SourceDir)/gram.tab.h
|
||||
$(SourceDir)/lex.c: gram.tab.h
|
||||
|
||||
clean::
|
||||
rm -ff gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp
|
||||
|
||||
$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h
|
||||
#$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h
|
||||
|
||||
doc.dvi: doc.tex
|
||||
latex doc; latex doc
|
||||
|
||||
+5
-7
@@ -1,20 +1,18 @@
|
||||
LEVEL = ../..
|
||||
TOOLNAME = burg
|
||||
ExtraSource = $(SourceDir)/gram.tab.c
|
||||
ExtraSource = gram.tab.c
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
VPATH=$(SourceDir)
|
||||
gram.tab.c gram.tab.h:: gram.yc
|
||||
$(VERB) $(BISON) -o gram.tab.c -d $<
|
||||
|
||||
$(SourceDir)/gram.tab.c $(SourceDir)/gram.tab.h:: gram.yc
|
||||
$(VERB) $(BISON) -o $(SourceDir)/gram.tab.c -d $<
|
||||
|
||||
$(SourceDir)/lex.c: $(SourceDir)/gram.tab.h
|
||||
$(SourceDir)/lex.c: gram.tab.h
|
||||
|
||||
clean::
|
||||
rm -ff gram.tab.h gram.tab.c core* *.aux *.log *.dvi sample sample.c tmp
|
||||
|
||||
$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h
|
||||
#$(BUILD_OBJ_DIR)/Release/lex.o $(BUILD_OBJ_DIR)/Profile/lex.o $(BUILD_OBJ_DIR)/Debug/lex.o: gram.tab.h
|
||||
|
||||
doc.dvi: doc.tex
|
||||
latex doc; latex doc
|
||||
|
||||
Reference in New Issue
Block a user