diff options
-rw-r--r-- | Makefile.rules | 32 | ||||
-rw-r--r-- | examples/BFtoLLVM/Makefile | 1 | ||||
-rw-r--r-- | examples/Fibonacci/Makefile | 1 | ||||
-rw-r--r-- | examples/HowToUseJIT/Makefile | 1 | ||||
-rw-r--r-- | examples/ModuleMaker/Makefile | 1 |
5 files changed, 28 insertions, 8 deletions
diff --git a/Makefile.rules b/Makefile.rules index 93b7788..d929ae8 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 e3074cc..0b4c429 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 2c9a531..a6d3785 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 3312eb8..0f5e26b 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 2bd8a38..91635d4 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 |