Skip to content

Commit ffe9070

Browse files
committed
[lldb][test] Build Swift Obj-C header separately
Emitting an Obj-C header isn't supported with `-primary-file`, as the header is emitted for the whole module. Instead, split the header generation out into its own target.
1 parent 782ffa8 commit ffe9070

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,17 +708,14 @@ MODULENAME?=$(DYLIB_NAME)
708708
PARSE_AS_LIBRARY = -parse-as-library
709709
endif
710710

711-
ifneq "$(SWIFT_OBJC_HEADER)" ""
712-
SWIFT_OBJC_HEADER_FLAGS=-emit-objc-header-path $(SWIFT_OBJC_HEADER)
713-
endif
714-
715711
VPATHSOURCES=$(patsubst %,$(VPATH)/%,$(SWIFT_SOURCES))
716-
%.o: %.swift $(SWIFT_BRIDGING_PCH)
712+
VPATHDYLIBSOURCES=$(patsubst %,$(VPATH)/%,$(DYLIB_SWIFT_SOURCES))
713+
714+
%.o: %.swift $(SWIFT_BRIDGING_PCH) $(SWIFT_OBJC_HEADER)
717715
@echo "### Compiling" $<
718716
$(SWIFT_FE) -c -primary-file $< \
719717
$(filter-out $(VPATH)/$<,$(filter-out $<,$(VPATHSOURCES))) \
720718
$(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) $(PARSE_AS_LIBRARY) \
721-
$(SWIFT_OBJC_HEADER_FLAGS) \
722719
-module-name $(MODULENAME) -emit-module-path \
723720
$(patsubst %.o,$(BUILDDIR)/%.partial.swiftmodule,$@) \
724721
-o $(BUILDDIR)/$@
@@ -763,6 +760,15 @@ $(SWIFT_BRIDGING_PCH): $(SWIFT_BRIDGING_HEADER)
763760
$(SWIFT_FE) -emit-pch $(SWIFT_FEFLAGS) $< -o $(BUILDDIR)/$@
764761
endif
765762

763+
# Swift Obj-C header.
764+
ifneq "$(SWIFT_OBJC_HEADER)" ""
765+
$(SWIFT_OBJC_HEADER): $(SWIFT_SOURCES) $(DYLIB_SWIFT_SOURCES)
766+
@echo "### Building Obj-C header"
767+
$(SWIFT_FE) -typecheck $(VPATHSOURCES) $(VPATHDYLIBSOURCES) \
768+
$(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) -module-name $(MODULENAME) \
769+
-emit-objc-header-path $(SWIFT_OBJC_HEADER)
770+
endif
771+
766772
else # USESWIFTDRIVER = 0
767773
#----------------------------------------------------------------------
768774

0 commit comments

Comments
 (0)