1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

makefiles: use single target

Possibly  easier to follow - to have just a single dependency line
and use  if() within rule.

Also replace $(words) with $(firstword) which is more commonly used.
This commit is contained in:
Zdenek Kabelac 2015-05-18 10:18:19 +02:00
parent fe00b163d6
commit bf2b1986c2

View File

@ -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
.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS)
ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
set -e; (echo "Base {"; echo " global:";\
$(SED) "s/^/ /;s/$$/;/" < $<; \
$(SED) "s/^/ /;s/$$/;/" $<;\
echo " local:"; echo " *;"; echo "};") > $@
else
.export.sym: .exported_symbols_generated $(EXPORTED_FILES)
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 \