@@ -465,6 +465,47 @@ endif
465
465
# Library Build Rules: Four ways to build a library
466
466
# ##############################################################################
467
467
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
468
509
469
510
# if we're building a library ...
470
511
ifdef LIBRARYNAME
@@ -1299,10 +1340,12 @@ printvars::
1299
1340
$(Echo ) " LibDir : " ' $(LibDir)'
1300
1341
$(Echo ) " ToolDir : " ' $(ToolDir)'
1301
1342
$(Echo ) " ExmplDir : " ' $(ExmplDir)'
1343
+ $(Echo ) " Sources : " ' $(Sources)'
1302
1344
$(Echo ) " TDFiles : " ' $(TDFiles)'
1303
1345
$(Echo ) " INCFiles : " ' $(INCFiles)'
1304
1346
$(Echo ) " Compile.CXX : " ' $(Compile.CXX)'
1305
1347
$(Echo ) " Compile.C : " ' $(Compile.C)'
1306
1348
$(Echo ) " Archive : " ' $(Archive)'
1307
1349
$(Echo ) " YaccFiles : " ' $(YaccFiles)'
1308
1350
$(Echo ) " LexFiles : " ' $(LexFiles)'
1351
+ $(Echo ) " Module : " ' $(Module)'
0 commit comments