ifeq (yes, $(build-shared))
+# Commands to put in a pipeline to preprocess a file with # comments
+# %ifdef et al based on config.h settings or other %include'd files.
+define preprocess-versions
+sed 's/#.*$$//;s/^[ ]*%/#/' \
+| $(CC) $(CPPFLAGS) -E -undef -include $(common-objpfx)config.h -x c - \
+| sed 's/#.*$$//;/^[ ]*$$/d'
+endef
+
# Process the shlib-versions file, which tells us what shared library
# version numbers to use when we install shared objects on this system.
# We need to wait until $(subdirs) is complete.
$(add-ons) \
$(subdirs))) \
$(common-objpfx)config.make
- sed -e 's/#.*$$//;s/^[ ]*%/#/' \
- $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
- | $(CC) -E -undef -include $(common-objpfx)config.h -x c - \
+ cat $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
+ | $(preprocess-versions) \
| while read conf version setname; do \
test -n "$$version" && \
test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
{ while read lib version setname; do \
test -z "$$setname" || echo "$$lib : $$setname"; \
done < $(word 2,$^); \
- cat $(filter-out $< $(word 2,$^),$^); \
+ cat $(filter-out $< $(word 2,$^),$^) \
+ | $(preprocess-versions); \
} | LC_ALL=C $(AWK) -f $< > $@T
mv -f $@T $@
$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
$(wildcard $(sysdirs:%=%/Versions)) \
$(sysd-versions-force)
{ echo 'sysd-versions-subdirs = $(all-subdirs) $(config-sysdirs)' ; \
- LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
- -v move_if_change='$(move-if-change)' \
- -f $(filter-out $< $(sysd-versions-force),$^); \
+ cat $(filter-out $< $(word 2,$^) $(sysd-versions-force),$^) \
+ | $(preprocess-versions) \
+ | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
+ -v move_if_change='$(move-if-change)' \
+ -f $(word 2,$^); \
} > $@T
mv -f $@T $@
endif # avoid-generated