diff --git a/make.tmpl.in b/make.tmpl.in index 2206cc228..4ad7f58d7 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -475,32 +475,30 @@ distclean: cleandir $(SUBDIRS.distclean) .exported_symbols_generated: $(EXPORTED_HEADER) .exported_symbols $(DEPS) set -e; \ ( cat $(srcdir)/.exported_symbols; \ - if test x$(EXPORTED_HEADER) != x; then \ + if test -n "$(EXPORTED_HEADER)"; then \ $(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \ $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \ fi \ ) > $@ EXPORTED_UC := $(shell echo $(EXPORTED_FN_PREFIX) | tr '[a-z]' '[A-Z]') -EXPORTED_FILES := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.exported_symbols.$(EXPORTED_UC)_[0-9_]*[0-9]) +EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.exported_symbols.$(EXPORTED_UC)_[0-9_]*[0-9]) -ifeq (0,$(words $(EXPORTED_FILES))) -.export.sym: .exported_symbols_generated - set -e; (echo "Base {"; echo " global:"; \ - $(SED) "s/^/ /;s/$$/;/" < $<; \ +.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS) +ifeq (,$(firstword $(EXPORTED_SYMBOLS))) + set -e; (echo "Base {"; echo " global:";\ + $(SED) "s/^/ /;s/$$/;/" $<;\ echo " local:"; echo " *;"; echo "};") > $@ - else -.export.sym: .exported_symbols_generated $(EXPORTED_FILES) - set -e; \ + set -e;\ R=$(shell sort $^ | uniq -u);\ test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\ - (for i in $(EXPORTED_FILES) ; do\ + for i in $(EXPORTED_SYMBOLS); do\ echo "$${i##*.} {"; echo " global:";\ - $(SED) "s/^/ /;s/$$/;/" < $$i;\ + $(SED) "s/^/ /;s/$$/;/" $$i;\ test "$$i" = Base && { echo " local:"; echo " *;"; };\ echo "};";\ - done ) > $@ + done > $@ endif ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov \