summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-09-09 20:57:03 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-09-09 20:57:03 +0000
commit410d1b5dea31e457c5c5b88e019874789c251aee (patch)
tree5cf37d7f35474a191ff9da815e9b8a5e30fed605
parentd9cd14440d6e44001d1280e75236b6a9d2247419 (diff)
downloadllvm-410d1b5dea31e457c5c5b88e019874789c251aee.tar.gz
llvm-410d1b5dea31e457c5c5b88e019874789c251aee.tar.bz2
llvm-410d1b5dea31e457c5c5b88e019874789c251aee.tar.xz
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
-rw-r--r--Makefile.rules34
-rw-r--r--lib/Target/SparcV9/Makefile21
-rw-r--r--lib/Target/X86/Makefile6
-rw-r--r--support/tools/Burg/Makefile12
-rw-r--r--utils/Burg/Makefile12
5 files changed, 45 insertions, 40 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 99556b46b9..283dfe2661 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -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' > $@
#
diff --git a/lib/Target/SparcV9/Makefile b/lib/Target/SparcV9/Makefile
index 47e8e193fa..0366844c14 100644
--- a/lib/Target/SparcV9/Makefile
+++ b/lib/Target/SparcV9/Makefile
@@ -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
+
diff --git a/lib/Target/X86/Makefile b/lib/Target/X86/Makefile
index 84d2e6d6a1..84f168a937 100644
--- a/lib/Target/X86/Makefile
+++ b/lib/Target/X86/Makefile
@@ -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::
diff --git a/support/tools/Burg/Makefile b/support/tools/Burg/Makefile
index 060e53706c..f653d60291 100644
--- a/support/tools/Burg/Makefile
+++ b/support/tools/Burg/Makefile
@@ -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
diff --git a/utils/Burg/Makefile b/utils/Burg/Makefile
index 060e53706c..f653d60291 100644
--- a/utils/Burg/Makefile
+++ b/utils/Burg/Makefile
@@ -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