Skip to content

Commit 27c8df9

Browse files
committed
Add dependency on swiftc for %.o.%.swift rules
Detect that swiftc has changed since the Swift file has been compiled and force it to be recompiled. The explicit rm of the target before regenerating it is needed because if the new compiler generates exactly the same bits as the old one the .o file isn't updated and the target gets stuck as being out-of-date. An explicit rm avoids that problem.
1 parent 367bd95 commit 27c8df9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Makefile.am

+4-2
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,17 @@ if DISPATCH_ENABLE_OPTIMIZATION
169169
SWIFTC_FLAGS+=-O
170170
endif
171171

172-
$(abs_builddir)/swift/%.o: $(abs_srcdir)/swift/%.swift
172+
$(abs_builddir)/swift/%.o: $(abs_srcdir)/swift/%.swift $(SWIFTC)
173+
@rm -f $@
173174
$(SWIFTC) -frontend -c $(SWIFT_ABS_SRC_FILES) -primary-file $< \
174175
$(SWIFTC_FLAGS) -module-name Dispatch -module-link-name dispatch \
175176
-o $@ -emit-module-path $@.~partial.swiftmodule \
176177
-emit-module-doc-path $@.~partial.swiftdoc -emit-dependencies-path $@.d \
177178
-emit-reference-dependencies-path $@.swiftdeps \
178179
-module-cache-path $(top_builddir)
179180

180-
$(abs_builddir)/swift/Dispatch.swiftmodule: $(SWIFT_ABS_SRC_FILES)
181+
$(abs_builddir)/swift/Dispatch.swiftmodule: $(SWIFT_ABS_SRC_FILES) $(SWIFTC)
182+
@rm -f $@
181183
$(SWIFTC) -frontend -emit-module $(SWIFT_OBJ_FILES:%=%.~partial.swiftmodule) \
182184
$(SWIFTC_FLAGS) -module-cache-path $(top_builddir) -module-link-name dispatch \
183185
-o $@ -emit-module-doc-path $(@:%.swiftmodule=%.swiftdoc)

0 commit comments

Comments
 (0)