summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-05 05:17:22 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-05 05:17:22 +0000
commit7980ea4cfa8d83927e26942256a2c9c4eec9c463 (patch)
tree6a1d720885af8bd83b01f2bd1a1b830ac19c6ce8 /Makefile.rules
parent5b554ade20e73b1c544aa2d9b5f4abe901a77d65 (diff)
downloadllvm-7980ea4cfa8d83927e26942256a2c9c4eec9c463.tar.gz
llvm-7980ea4cfa8d83927e26942256a2c9c4eec9c463.tar.bz2
llvm-7980ea4cfa8d83927e26942256a2c9c4eec9c463.tar.xz
Add ability to make a single bytecode module from others
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules43
1 files changed, 43 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 7ab2595660..4a69bff324 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -465,6 +465,47 @@ endif
# Library Build Rules: Four ways to build a library
###############################################################################
+#---------------------------------------------------------
+# Bytecode Module Targets:
+# If the user set MODULE_NAME then they want to build a
+# bytecode module from the sources. We compile all the
+# sources and link it together into a single bytecode
+# module.
+#---------------------------------------------------------
+
+ifdef MODULE_NAME
+
+Module := $(LibDir)/$(MODULE_NAME).bc
+LinkModule := $(LLVMGCC) -shared -nostdlib
+
+ifdef EXPORTED_SYMBOL_FILE
+LinkMOdule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+endif
+
+$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
+ $(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@)
+ $(Verb) $(LinkModule) -o $@ $(ObjectsBC)
+
+all-local:: $(Module)
+
+clean-local::
+ifneq ($(strip $(Module)),)
+ -$(Verb) $(RM) -f $(Module)
+endif
+
+DestModule := $(bytecode_libdir)/$(MODULE_NAME).bc
+
+install-local:: $(DestModule)
+
+$(DestModule): $(bytecode_libdir) $(Module)
+ $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
+ $(Verb) $(INSTALL) $(Module) $@
+
+uninstall-local::
+ $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
+ -$(Verb) $(RM) -f $(DestModule)
+
+endif
# if we're building a library ...
ifdef LIBRARYNAME
@@ -1299,6 +1340,7 @@ printvars::
$(Echo) "LibDir : " '$(LibDir)'
$(Echo) "ToolDir : " '$(ToolDir)'
$(Echo) "ExmplDir : " '$(ExmplDir)'
+ $(Echo) "Sources : " '$(Sources)'
$(Echo) "TDFiles : " '$(TDFiles)'
$(Echo) "INCFiles : " '$(INCFiles)'
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
@@ -1306,3 +1348,4 @@ printvars::
$(Echo) "Archive : " '$(Archive)'
$(Echo) "YaccFiles : " '$(YaccFiles)'
$(Echo) "LexFiles : " '$(LexFiles)'
+ $(Echo) "Module : " '$(Module)'