summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-11-18 10:03:46 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-11-18 10:03:46 +0000
commit815cbcf0f1ebf91712dc391708dd93e99efd0732 (patch)
tree7f61c699edb3cc1407326865f3fa1791fa52724c
parentb0ce1a387ce1c86b8b0008518a99d786006d1f32 (diff)
downloadllvm-815cbcf0f1ebf91712dc391708dd93e99efd0732.tar.gz
llvm-815cbcf0f1ebf91712dc391708dd93e99efd0732.tar.bz2
llvm-815cbcf0f1ebf91712dc391708dd93e99efd0732.tar.xz
Fix PR456:\
Tools and libraries will be built into $(BUILD_OBJ_ROOT)/$(BuildMode)/bin and \ $(BUILD_OBJ_ROOT)/$(BuildMode)/lib, respectively. Furthermore, the example \ programs will go in $(BUILD_OBJ_ROOT)/$(BuildMode)/examples to keep them \ separate from the tools and hopefully out of the PATH. Install targets \ have not changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17953 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile.rules32
-rw-r--r--examples/BFtoLLVM/Makefile1
-rw-r--r--examples/Fibonacci/Makefile1
-rw-r--r--examples/HowToUseJIT/Makefile1
-rw-r--r--examples/ModuleMaker/Makefile1
5 files changed, 28 insertions, 8 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 93b77886db..d929ae8974 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -176,10 +176,12 @@ LibTool.Flags := --tag=CXX
# Directory locations
#--------------------------------------------------------------------
ObjDir := $(BUILD_OBJ_DIR)/$(BuildMode)
-LibDir := $(BUILD_OBJ_ROOT)/lib/$(BuildMode)
-ToolDir := $(BUILD_OBJ_ROOT)/tools/$(BuildMode)
-LLVMLibDir := $(LLVM_OBJ_ROOT)/lib/$(BuildMode)
-LLVMToolDir := $(LLVM_OBJ_ROOT)/tools/$(BuildMode)
+LibDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/lib
+ToolDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/tools
+ExmplDir := $(BUILD_OBJ_ROOT)/$(BuildMode)/examples
+LLVMLibDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
+LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/tools
+LExmplDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
#--------------------------------------------------------------------
# Full Paths To Compiled Tools and Utilities
@@ -248,8 +250,12 @@ endif
# Adjust linker flags for building an executable
ifdef TOOLNAME
+ifdef EXAMPLE_TOOL
+ LD.Flags += -rpath $(ExmplDir) -export-dynamic
+else
LD.Flags += -rpath $(ToolDir) -export-dynamic
endif
+endif
#----------------------------------------------------------
# Options To Invoke Tools
@@ -337,8 +343,8 @@ $(sysconfdir):
$(Verb) $(MKDIR) $* > /dev/null
@$(DATE) > $@
-.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(LLVMLibDir)/.dir
-.PRECIOUS: $(LLVMToolDir)/.dir
+.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir
+.PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir
#---------------------------------------------------------
# Handle the DIRS options for sequential construction
@@ -609,7 +615,11 @@ ifdef TOOLNAME
#---------------------------------------------------------
# Set up variables for building a tool.
#---------------------------------------------------------
+ifdef EXAMPLE_TOOL
+ToolBuildPath := $(ExmplDir)/$(TOOLNAME)$(EXEEXT)
+else
ToolBuildPath := $(ToolDir)/$(TOOLNAME)$(EXEEXT)
+endif
ProjLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(USEDLIBS)))
ProjLibsOptions := $(patsubst %.o, $(LibDir)/%.o, $(ProjLibsOptions))
LLVMLibsOptions := $(patsubst %.a.o, -l%, $(addsuffix .o, $(LLVMLIBS)))
@@ -647,8 +657,13 @@ ifneq ($(strip $(ToolBuildPath)),)
-$(Verb) $(RM) -f $(ToolBuildPath)
endif
-$(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)\
- $(ToolDir)/.dir
+ifdef EXAMPLE_TOOL
+$(ToolBuildPath): $(ExmplDir)/.dir
+else
+$(ToolBuildPath): $(ToolDir)/.dir
+endif
+
+$(ToolBuildPath): $(BUILT_SOURCES) $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
$(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
$(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB)
@@ -1194,6 +1209,7 @@ printvars::
$(Echo) "ObjDir : " '$(ObjDir)'
$(Echo) "LibDir : " '$(LibDir)'
$(Echo) "ToolDir : " '$(ToolDir)'
+ $(Echo) "ExmplDir : " '$(ExmplDir)'
$(Echo) "TDFiles : " '$(TDFiles)'
$(Echo) "INCFiles : " '$(INCFiles)'
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
diff --git a/examples/BFtoLLVM/Makefile b/examples/BFtoLLVM/Makefile
index e3074cc683..0b4c429a39 100644
--- a/examples/BFtoLLVM/Makefile
+++ b/examples/BFtoLLVM/Makefile
@@ -9,4 +9,5 @@
LEVEL = ../..
TOOLNAME = BFtoLLVM
+EXAMPLE_TOOL = 1
include $(LEVEL)/Makefile.common
diff --git a/examples/Fibonacci/Makefile b/examples/Fibonacci/Makefile
index 2c9a53149c..a6d378591f 100644
--- a/examples/Fibonacci/Makefile
+++ b/examples/Fibonacci/Makefile
@@ -9,6 +9,7 @@
LEVEL = ../..
TOOLNAME = Fibonacci
+EXAMPLE_TOOL = 1
# Enable JIT support
include $(LEVEL)/tools/Makefile.JIT
diff --git a/examples/HowToUseJIT/Makefile b/examples/HowToUseJIT/Makefile
index 3312eb8209..0f5e26b5ca 100644
--- a/examples/HowToUseJIT/Makefile
+++ b/examples/HowToUseJIT/Makefile
@@ -8,6 +8,7 @@
##===----------------------------------------------------------------------===##
LEVEL = ../..
TOOLNAME = HowToUseJIT
+EXAMPLE_TOOL = 1
# Enable JIT support
include $(LEVEL)/tools/Makefile.JIT
diff --git a/examples/ModuleMaker/Makefile b/examples/ModuleMaker/Makefile
index 2bd8a38b7e..91635d48f9 100644
--- a/examples/ModuleMaker/Makefile
+++ b/examples/ModuleMaker/Makefile
@@ -8,6 +8,7 @@
##===----------------------------------------------------------------------===##
LEVEL=../..
TOOLNAME=ModuleMaker
+EXAMPLE_TOOL = 1
USEDLIBS= LLVMBCWriter LLVMCore LLVMSupport.a LLVMSystem.a
include $(LEVEL)/Makefile.common