Skip to content

Commit 24570bc

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 085182e commit 24570bc

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
@@ -700,17 +700,14 @@ MODULENAME?=$(DYLIB_NAME)
700700
PARSE_AS_LIBRARY = -parse-as-library
701701
endif
702702

703-
ifneq "$(SWIFT_OBJC_HEADER)" ""
704-
SWIFT_OBJC_HEADER_FLAGS=-emit-objc-header-path $(SWIFT_OBJC_HEADER)
705-
endif
706-
707703
VPATHSOURCES=$(patsubst %,$(VPATH)/%,$(SWIFT_SOURCES))
708-
%.o: %.swift $(SWIFT_BRIDGING_PCH)
704+
VPATHDYLIBSOURCES=$(patsubst %,$(VPATH)/%,$(DYLIB_SWIFT_SOURCES))
705+
706+
%.o: %.swift $(SWIFT_BRIDGING_PCH) $(SWIFT_OBJC_HEADER)
709707
@echo "### Compiling" $<
710708
$(SWIFT_FE) -c -primary-file $< \
711709
$(filter-out $(VPATH)/$<,$(filter-out $<,$(VPATHSOURCES))) \
712710
$(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) $(PARSE_AS_LIBRARY) \
713-
$(SWIFT_OBJC_HEADER_FLAGS) \
714711
-module-name $(MODULENAME) -emit-module-path \
715712
$(patsubst %.o,$(BUILDDIR)/%.partial.swiftmodule,$@) \
716713
-o $(BUILDDIR)/$@
@@ -755,6 +752,15 @@ $(SWIFT_BRIDGING_PCH): $(SWIFT_BRIDGING_HEADER)
755752
$(SWIFT_FE) -emit-pch $(SWIFT_FEFLAGS) $< -o $(BUILDDIR)/$@
756753
endif
757754

755+
# Swift Obj-C header.
756+
ifneq "$(SWIFT_OBJC_HEADER)" ""
757+
$(SWIFT_OBJC_HEADER): $(SWIFT_SOURCES) $(DYLIB_SWIFT_SOURCES)
758+
@echo "### Building Obj-C header"
759+
$(SWIFT_FE) -typecheck $(VPATHSOURCES) $(VPATHDYLIBSOURCES) \
760+
$(SWIFT_FEFLAGS) $(SWIFT_HFLAGS) -module-name $(MODULENAME) \
761+
-emit-objc-header-path $(SWIFT_OBJC_HEADER)
762+
endif
763+
758764
else # USESWIFTDRIVER = 0
759765
#----------------------------------------------------------------------
760766

0 commit comments

Comments
 (0)