Skip to content

Commit a5f9cd2

Browse files
committed
Makefiles: Promote EXCLUDE_WRAPPED_SWIFTMODULE into a more general DYLIB_HIDE_SWIFTMODULE facility.
1 parent a896984 commit a5f9cd2

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,7 @@ MODULENAME?=$(DYLIB_NAME)
587587
PARSE_AS_LIBRARY = -parse-as-library
588588
endif
589589

590-
VPATHSOURCES=$(patsubst %,$(VPATH)/%,$(SWIFT_SOURCES))
591-
VPATHDYLIBSOURCES=$(patsubst %,$(VPATH)/%,$(DYLIB_SWIFT_SOURCES))
590+
VPATHSOURCES=$(patsubst %,$(VPATH)/%,$(SWIFT_SOURCES)) $(patsubst %,$(VPATH)/%,$(DYLIB_SWIFT_SOURCES))
592591

593592
%.o: %.swift $(SWIFT_BRIDGING_PCH) $(SWIFT_OBJC_HEADER)
594593
@echo "### Compiling" $<
@@ -602,8 +601,8 @@ VPATHDYLIBSOURCES=$(patsubst %,$(VPATH)/%,$(DYLIB_SWIFT_SOURCES))
602601
ifeq "$(OS)" "Darwin"
603602
$(EXE): $(MODULENAME).swiftmodule $(OBJECTS)
604603
@echo "### Linking" $(EXE)
605-
$(SWIFTC) $(LD_EXTRAS) \
606-
$(patsubst $<,-Xlinker -add_ast_path -Xlinker $(BUILDDIR)/$<,$^) \
604+
$(SWIFTC) $(LD_EXTRAS) $(OBJECTS) \
605+
-Xlinker -add_ast_path -Xlinker $(MODULENAME).swiftmodule \
607606
$(patsubst -g,,$(SWIFTFLAGS)) -o "$(EXE)"
608607
ifneq "$(CODESIGN)" ""
609608
$(CODESIGN) -s - "$(EXE)"
@@ -625,8 +624,9 @@ endif
625624
$(MODULENAME).swiftmodule: $(OBJECTS) $(DYLIB_OBJECTS)
626625
@echo "### Merging swift modules for $(MODULENAME)"
627626
$(SWIFT_FE) $(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) -merge-modules \
628-
-emit-module $(patsubst %.swift,%.partial.swiftmodule,$(SWIFT_SOURCES) $(DYLIB_SWIFT_SOURCES)) \
627+
-emit-module \
629628
-emit-module-interface-path $(BUILDDIR)/$(MODULENAME).swiftinterface \
629+
$(patsubst %.swift,%.partial.swiftmodule,$(SWIFT_SOURCES) $(DYLIB_SWIFT_SOURCES)) \
630630
-disable-diagnostic-passes -disable-sil-perf-optzns \
631631
-module-name $(MODULENAME) \
632632
-o $(BUILDDIR)/$@
@@ -642,7 +642,7 @@ endif
642642
ifneq "$(SWIFT_OBJC_HEADER)" ""
643643
$(SWIFT_OBJC_HEADER): $(SWIFT_SOURCES) $(DYLIB_SWIFT_SOURCES)
644644
@echo "### Building Obj-C header"
645-
$(SWIFT_FE) -typecheck $(VPATHSOURCES) $(VPATHDYLIBSOURCES) \
645+
$(SWIFT_FE) -typecheck $(VPATHSOURCES) \
646646
$(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) -module-name $(MODULENAME) \
647647
-emit-objc-header-path $(SWIFT_OBJC_HEADER)
648648
endif
@@ -693,21 +693,23 @@ ifeq "$(USESWIFTDRIVER)" "1"
693693
ifeq "$(OS)" "Darwin"
694694
DYLIB_SWIFT_FLAGS= \
695695
-Xlinker -dylib \
696-
-Xlinker -add_ast_path -Xlinker $(DYLIB_NAME).swiftmodule \
697696
-Xlinker -install_name -Xlinker @executable_path/$(shell basename $@) \
698697
$(LD_EXTRAS)
698+
ifeq "$(DYLIB_HIDE_SWIFTMODULE)" ""
699+
DYLIB_SWIFT_FLAGS+= -Xlinker -add_ast_path -Xlinker $(DYLIB_NAME).swiftmodule
700+
endif
699701
else
700702
DYLIB_SWIFT_FLAGS=$(LD_EXTRAS)
701703
endif
702-
$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
704+
$(DYLIB_FILENAME) : $(DYLIB_OBJECTS) $(MODULE_INTERFACE)
703705
@echo "### Linking dynamic library $(DYLIB_NAME)"
704-
ifneq "$(EXCLUDE_WRAPPED_SWIFTMODULE)" ""
706+
ifneq "$(DYLIB_HIDE_SWIFTMODULE)" ""
705707
$(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) \
706708
-emit-library $(DYLIB_SWIFT_FLAGS) -o $@ \
707-
$(patsubst %.swiftmodule.o,,$^)
709+
$(patsubst %.swiftmodule.o,,$(DYLIB_OBJECTS))
708710
else
709711
$(SWIFTC) $(patsubst -g,,$(SWIFTFLAGS)) \
710-
-emit-library $(DYLIB_SWIFT_FLAGS) -o $@ $^
712+
-emit-library $(DYLIB_SWIFT_FLAGS) -o $@ $(DYLIB_OBJECTS)
711713
endif
712714
ifneq "$(CODESIGN)" ""
713715
$(CODESIGN) -s - "$(DYLIB_FILENAME)"

lldb/test/API/lang/swift/expression/equality_operators/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ include Makefile.rules
1010
libfooey.dylib: one.swift two.swift
1111
$(MAKE) -f $(MAKEFILE_RULES) \
1212
MAKE_DSYM=YES DYLIB_ONLY=YES DYLIB_NAME=fooey \
13-
SWIFT_SOURCES="one.swift two.swift" \
13+
DYLIB_SWIFT_SOURCES="one.swift two.swift" \
1414
SWIFTFLAGS_EXTRAS=-I$(BUILDDIR)

lldb/test/API/lang/swift/implementation_only_imports/dylib.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DYLIB_NAME := $(BASENAME)
44
DYLIB_SWIFT_SOURCES := $(DYLIB_NAME).swift
55
# Disable debug info for the library.
66
override MAKE_DSYM := NO
7-
EXCLUDE_WRAPPED_SWIFTMODULE := YES
7+
DYLIB_HIDE_SWIFTMODULE := YES
88
SWIFTFLAGS := -gnone -I. -module-link-name $(BASENAME)
99
LD_EXTRAS := -L.
1010

lldb/test/API/lang/swift/parseable_interfaces/dsym/libs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SWIFTFLAGS=-Onone -Xfrontend -serialize-debugging-options -enable-library-evolut
1010
# the .swiftinterface. The issue here is that if the .swiftmodule is wrapped
1111
# and linked into the dylib, LLDB will find it there and load it before the
1212
# .swiftinterface loading path can be exercised.
13-
EXCLUDE_WRAPPED_SWIFTMODULE=1
13+
DYLIB_HIDE_SWIFTMODULE=1
1414
endif
1515

1616
include Makefile.rules

lldb/test/API/lang/swift/parseable_interfaces/shared/libs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SWIFTFLAGS=-Onone -Xfrontend -serialize-debugging-options -enable-library-evolut
99
# the .swiftinterface. The issue here is that if the .swiftmodule is wrapped
1010
# and linked into the dylib, LLDB will find it there and load it before the
1111
# .swiftinterface loading path can be exercised.
12-
EXCLUDE_WRAPPED_SWIFTMODULE=1
12+
DYLIB_HIDE_SWIFTMODULE=1
1313

1414
include Makefile.rules
1515

lldb/test/API/lang/swift/parseable_interfaces/static/libs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SWIFTFLAGS_EXTRAS := -enable-library-evolution
1111
# the .swiftinterface. The issue here is that if the .swiftmodule is wrapped
1212
# and linked into the library, LLDB may find it there and load it before the
1313
# .swiftinterface loading path can be exercised.
14-
EXCLUDE_WRAPPED_SWIFTMODULE=1
14+
DYLIB_HIDE_SWIFTMODULE=1
1515

1616
include Makefile.rules
1717

lldb/test/API/lang/swift/playgrounds-repl/Makefile.common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PlaygroundStub: libPlaygroundsRuntime.dylib
66
include Makefile.rules
77

88
ifneq ($(MAKECMDGOALS),libPlaygroundsRuntime.dylib)
9+
LD_EXTRAS := -L. -lPlaygroundsRuntime
910
libPlaygroundsRuntime.dylib: PlaygroundsRuntime.swift
1011
$(MAKE) -C $(BUILDDIR) -f $(SRCDIR)/Makefile \
1112
SWIFT_SOURCES= DYLIB_SWIFT_SOURCES=PlaygroundsRuntime.swift \

lldb/test/API/lang/swift/playgrounds/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SWIFT_SOURCES = PlaygroundStub.swift
44
# The deployment target we set is pre-ABI stability. The Swift driver will not
55
# point the RPATH at the system library. Do it manually.
66
LD_EXTRAS := -Xlinker -rpath -Xlinker /usr/lib/swift
7+
LD_EXTRAS += -L. -lPlaygroundsRuntime
78

89
PlaygroundStub: libPlaygroundsRuntime.dylib
910

0 commit comments

Comments
 (0)