Skip to content

Commit d78077d

Browse files
author
Reid Spencer
committed
Add ability to make a single bytecode module from others
llvm-svn: 18523
1 parent 7527cd5 commit d78077d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/Makefile.rules

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,47 @@ endif
465465
# Library Build Rules: Four ways to build a library
466466
###############################################################################
467467

468+
#---------------------------------------------------------
469+
# Bytecode Module Targets:
470+
# If the user set MODULE_NAME then they want to build a
471+
# bytecode module from the sources. We compile all the
472+
# sources and link it together into a single bytecode
473+
# module.
474+
#---------------------------------------------------------
475+
476+
ifdef MODULE_NAME
477+
478+
Module := $(LibDir)/$(MODULE_NAME).bc
479+
LinkModule := $(LLVMGCC) -shared -nostdlib
480+
481+
ifdef EXPORTED_SYMBOL_FILE
482+
LinkMOdule += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
483+
endif
484+
485+
$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
486+
$(Echo) Building $(BuildMOde) Bytecode Module $(notdir $@)
487+
$(Verb) $(LinkModule) -o $@ $(ObjectsBC)
488+
489+
all-local:: $(Module)
490+
491+
clean-local::
492+
ifneq ($(strip $(Module)),)
493+
-$(Verb) $(RM) -f $(Module)
494+
endif
495+
496+
DestModule := $(bytecode_libdir)/$(MODULE_NAME).bc
497+
498+
install-local:: $(DestModule)
499+
500+
$(DestModule): $(bytecode_libdir) $(Module)
501+
$(Echo) Installing $(BuildMode) Bytecode Module $(DestModule)
502+
$(Verb) $(INSTALL) $(Module) $@
503+
504+
uninstall-local::
505+
$(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule)
506+
-$(Verb) $(RM) -f $(DestModule)
507+
508+
endif
468509

469510
# if we're building a library ...
470511
ifdef LIBRARYNAME
@@ -1299,10 +1340,12 @@ printvars::
12991340
$(Echo) "LibDir : " '$(LibDir)'
13001341
$(Echo) "ToolDir : " '$(ToolDir)'
13011342
$(Echo) "ExmplDir : " '$(ExmplDir)'
1343+
$(Echo) "Sources : " '$(Sources)'
13021344
$(Echo) "TDFiles : " '$(TDFiles)'
13031345
$(Echo) "INCFiles : " '$(INCFiles)'
13041346
$(Echo) "Compile.CXX : " '$(Compile.CXX)'
13051347
$(Echo) "Compile.C : " '$(Compile.C)'
13061348
$(Echo) "Archive : " '$(Archive)'
13071349
$(Echo) "YaccFiles : " '$(YaccFiles)'
13081350
$(Echo) "LexFiles : " '$(LexFiles)'
1351+
$(Echo) "Module : " '$(Module)'

0 commit comments

Comments
 (0)