Control Makefile verbosity level with V=.

Instead of using @ directly most of the time, use $(v) which can be
'' or @ controlled by V. Defaults to 0. make V=1 for a verbose make.
This commit is contained in:
Aaron Gyes 2016-07-18 13:48:15 -07:00
parent 71e1e38426
commit d7604dcc99

View file

@ -23,8 +23,12 @@
# applications, install them, and recalculate dependencies. # applications, install them, and recalculate dependencies.
# #
# This makes things rather quiet. # Verbosity
MAKEFLAGS += --silent # make V=1 causes a noisy make, V=0 is silent/quiet. If one uses (lower case v)
# $(v) as a substitute for @, it will get swapped out in the default (V=1) case
# and replced with @ in the V=0 case. You can use a bare @ for things that should
# (really) almost never print.
V := 0
# #
# This is the default value for SHELL but I like to be explicit about such # This is the default value for SHELL but I like to be explicit about such
@ -41,7 +45,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
# #
# Programs # Programs
# #
CXX := @CXX@ CXX = ${v}@CXX@
INSTALL:=@INSTALL@ INSTALL:=@INSTALL@
SED := @SED@ SED := @SED@
@ -211,7 +215,7 @@ TERM_COLORS := $(shell tput colors 2> /dev/null)
define echo_bold define echo_bold
@tput bold 2> /dev/null ||: @tput bold 2> /dev/null ||:
echo $1 $(v)echo $1
@tput sgr0 2> /dev/null ||: @tput sgr0 2> /dev/null ||:
endef endef
@ -227,9 +231,9 @@ define echo_italic
endef endef
define showvar define showvar
@$(call echo_bold,"$1 = \c") $(v)$(call echo_bold,"$1 = \c")
@$(call echo_italic,"'$2'\c") $(v)$(call echo_italic,"'$2'\c")
@echo $3 $(v)echo $3
endef endef
# #
@ -237,13 +241,13 @@ endef
# #
all: SHOW-VARS $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc share/__fish_build_paths.fish all: SHOW-VARS $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc share/__fish_build_paths.fish
@echo "\nfish has now been built." @echo "\nfish has now been built."
@$(call echo_bold, "Use \`$(notdir $(MAKE)) install' to install fish.") $(v)$(call echo_bold, "Use \`$(notdir $(MAKE)) install' to install fish.")
.PHONY: all .PHONY: all
SHOW-VARS: FORCE SHOW-VARS: FORCE
@${call showvar, "prefix",$(prefix),"\t\c"} @${call showvar, "prefix",$(prefix),"\t\c"}
@${call showvar, "HAVE_DOXYGEN",$(HAVE_DOXYGEN),"\t\c"} @${call showvar, "HAVE_DOXYGEN",$(HAVE_DOXYGEN),"\t\c"}
@${call showvar, "CXX",$(CXX)} @${call showvar, "CXX",@CXX@}
@${call showvar, "CXXFLAGS",$(CXXFLAGS)} @${call showvar, "CXXFLAGS",$(CXXFLAGS)}
.PHONY: FORCE .PHONY: FORCE
@ -251,10 +255,9 @@ SHOW-VARS: FORCE
# Pull version information # Pull version information
# #
FISH-BUILD-VERSION-FILE: FORCE FISH-BUILD-VERSION-FILE: FORCE
@-tput setaf 3 2> /dev/null -$(v)tput setaf 3 2> /dev/null
@echo " \c" $(v)build_tools/git_version_gen.sh
@build_tools/git_version_gen.sh -$(v)tput sgr0 2> /dev/null
@-tput sgr0 2> /dev/null
-include FISH-BUILD-VERSION-FILE -include FISH-BUILD-VERSION-FILE
CXXFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\" CXXFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
.PHONY: FORCE .PHONY: FORCE
@ -265,10 +268,10 @@ obj/fish_version.o: FISH-BUILD-VERSION-FILE
# when the source code for the build configuration has changed. # when the source code for the build configuration has changed.
# #
configure: configure.ac configure: configure.ac
./config.status -q --recheck $(v)./config.status -q --recheck
Makefile: Makefile.in configure Makefile: Makefile.in configure
./config.status -q $(v)./config.status -q
# #
# Build fish with some debug flags specified. This is GCC specific, # Build fish with some debug flags specified. This is GCC specific,
@ -289,8 +292,8 @@ prof: all
# #
doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h \ doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h \
$(HDR_FILES) lexicon_filter $(HDR_FILES) lexicon_filter
echo " doxygen user_doc/html" @echo " doxygen user_doc/html"
(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \ $(v)(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \
echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | \ echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | \
doxygen - && touch user_doc; \ doxygen - && touch user_doc; \
cd user_doc/html && rm -f arrow*.png bc_s.png bdwn.png closed.png \ cd user_doc/html && rm -f arrow*.png bc_s.png bdwn.png closed.png \
@ -301,10 +304,10 @@ doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h \
# PDF version of the source code documentation. # PDF version of the source code documentation.
# #
doc/refman.pdf: doc doc/refman.pdf: doc
cd doc/latex && \ $(v)cd doc/latex && \
make && \ $(v)$(MAKE) V=$(V) && \
mv refman.pdf ..; $(v)mv refman.pdf ..;
rm -rf doc/latex; $(v)rm -rf doc/latex;
# #
# Prep the environment for running the unit tests. When specifying DESTDIR on # Prep the environment for running the unit tests. When specifying DESTDIR on
@ -313,12 +316,12 @@ doc/refman.pdf: doc
# followed by `make install`. # followed by `make install`.
# #
test-prep: test-prep:
rm -rf test $(v)rm -rf test
mkdir test test/data test/home test/temp $(v)mkdir test test/data test/home test/temp
ifdef DESTDIR ifdef DESTDIR
ln -s $(DESTDIR) test/root $(v)ln -s $(DESTDIR) test/root
else else
mkdir test/root $(v)mkdir test/root
endif endif
.PHONY: test-prep .PHONY: test-prep
@ -331,8 +334,8 @@ endif
test: DESTDIR = $(PWD)/test/root/ test: DESTDIR = $(PWD)/test/root/
test: prefix = . test: prefix = .
test: test-prep install-force test_low_level test_high_level test: test-prep install-force test_low_level test_high_level
@rm -f /tmp/file_truncation_test.txt /tmp/tee_test.txt /tmp/fish_foo.txt $(v)rm -f /tmp/file_truncation_test.txt /tmp/tee_test.txt /tmp/fish_foo.txt
@rm -rf /tmp/is_potential_path_test $(v)rm -rf /tmp/is_potential_path_test
.PHONY: test .PHONY: test
# #
@ -374,8 +377,8 @@ test_interactive: $(call filter_up_to,test_interactive,$(active_test_goals))
# builtins # builtins
# #
doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in
rm -f command_list.tmp command_list_toc.tmp $@ $(v)rm -f command_list.tmp command_list_toc.tmp $@
for i in `printf "%s\n" $(HELP_SRC)|sort`; do \ $(v)for i in `printf "%s\n" $(HELP_SRC)|sort`; do \
echo "<hr>" >>command_list.tmp; \ echo "<hr>" >>command_list.tmp; \
cat $$i >>command_list.tmp; \ cat $$i >>command_list.tmp; \
echo >>command_list.tmp; \ echo >>command_list.tmp; \
@ -384,28 +387,28 @@ doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in
echo '- <a href="#'$$NAME'">'$$NAME'</a>' >> command_list_toc.tmp; \ echo '- <a href="#'$$NAME'">'$$NAME'</a>' >> command_list_toc.tmp; \
echo "Back to <a href='index.html#toc-commands'>index</a>". >>command_list.tmp; \ echo "Back to <a href='index.html#toc-commands'>index</a>". >>command_list.tmp; \
done done
mv command_list.tmp command_list.txt $(v)mv command_list.tmp command_list.txt
mv command_list_toc.tmp command_list_toc.txt $(v)mv command_list_toc.tmp command_list_toc.txt
cat $@.in | awk '{if ($$0 ~ /@command_list_toc@/) { system("cat command_list_toc.txt"); } else if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@ $(v)cat $@.in | awk '{if ($$0 ~ /@command_list_toc@/) { system("cat command_list_toc.txt"); } else if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@
toc.txt: $(HDR_FILES:index.hdr=index.hdr.in) toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
rm -f toc.tmp $@ $(v)rm -f toc.tmp $@
# Ugly hack to set the toc initial title for the main page # Ugly hack to set the toc initial title for the main page
echo '- <a href="index.html" id="toc-index">Documentation</a>' > toc.tmp $(v)echo '- <a href="index.html" id="toc-index">Documentation</a>' > toc.tmp
# The first sed command captures the page name, followed by the description # The first sed command captures the page name, followed by the description
# The second sed command captures the command name \1 and the description \2, but only up to a dash # The second sed command captures the command name \1 and the description \2, but only up to a dash
# This is to reduce the size of the TOC in the command listing on the main page # This is to reduce the size of the TOC in the command listing on the main page
for i in $(HDR_FILES:index.hdr=index.hdr.in); do\ $(v)for i in $(HDR_FILES:index.hdr=index.hdr.in); do\
NAME=`basename $$i .hdr`; \ NAME=`basename $$i .hdr`; \
NAME=`basename $$NAME .hdr.in`; \ NAME=`basename $$NAME .hdr.in`; \
$(SED) <$$i >>toc.tmp -n \ $(SED) <$$i >>toc.tmp -n \
-e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'$$NAME'.html" id="toc-'$$NAME'">\2</a>,p' \ -e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'$$NAME'.html" id="toc-'$$NAME'">\2</a>,p' \
-e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$$, - <a href="'$$NAME'.html#\1">\2</a>,p'; \ -e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$$, - <a href="'$$NAME'.html#\1">\2</a>,p'; \
done done
mv toc.tmp $@ $(v)mv toc.tmp $@
doc_src/index.hdr: toc.txt doc_src/index.hdr.in doc_src/index.hdr: toc.txt doc_src/index.hdr.in
cat $@.in | awk '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@ $(v)cat $@.in | awk '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@
# #
# To enable the lexicon filter, we first need to be aware of what fish # To enable the lexicon filter, we first need to be aware of what fish
@ -417,10 +420,10 @@ doc_src/index.hdr: toc.txt doc_src/index.hdr.in
# used in a 'cli' style context. # used in a 'cli' style context.
# #
lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish
rm -f lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@ $(v)rm -f lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter. # Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
echo " SED\t "$@ @echo " SED "$@
$(SED) <command_list_toc.txt >>lexicon.tmp -n \ $(v)$(SED) <command_list_toc.txt >>lexicon.tmp -n \
-e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \ -e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \
-e "s|'\(.*\)'|bltn \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt; \ -e "s|'\(.*\)'|bltn \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt; \
printf "%s\n" $(COMPLETIONS_DIR_FILES) | $(SED) -n \ printf "%s\n" $(COMPLETIONS_DIR_FILES) | $(SED) -n \
@ -448,12 +451,12 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
# providing suitable CSS in user_doc.css.in # providing suitable CSS in user_doc.css.in
# #
lexicon_filter: lexicon.txt lexicon_filter.in lexicon_filter: lexicon.txt lexicon_filter.in
rm -f $@.tmp $@ $(v)rm -f $@.tmp $@
echo " SED\t "$@ @echo " SED "$@
# Set the shebang as sed can reside in multiple places. # Set the shebang as sed can reside in multiple places.
$(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|' $(v)$(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|'
# Scan through the lexicon, transforming each line to something useful to Doxygen. # Scan through the lexicon, transforming each line to something useful to Doxygen.
if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \ $(v)if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \
WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \ WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \
else \ else \
WORDBL='\\<'; WORDBR='\\>'; \ WORDBL='\\<'; WORDBR='\\>'; \
@ -470,7 +473,7 @@ lexicon_filter: lexicon.txt lexicon_filter.in
# documentation. # documentation.
# #
doc.h: $(HDR_FILES) doc.h: $(HDR_FILES)
cat $(HDR_FILES) >$@ $(v)cat $(HDR_FILES) >$@
# #
# This rule creates complete doxygen headers from each of the various # This rule creates complete doxygen headers from each of the various
@ -488,7 +491,7 @@ doc.h: $(HDR_FILES)
# if any of the paths change. # if any of the paths change.
# #
%: %.in Makefile FISH-BUILD-VERSION-FILE %: %.in Makefile FISH-BUILD-VERSION-FILE
$(SED) <$< >$@ \ $(v)$(SED) <$< >$@ \
-e "s,@sysconfdir\@,$(sysconfdir),g" \ -e "s,@sysconfdir\@,$(sysconfdir),g" \
-e "s,@datadir\@,$(datadir),g" \ -e "s,@datadir\@,$(datadir),g" \
-e "s,@docdir\@,$(docdir),g" \ -e "s,@docdir\@,$(docdir),g" \
@ -510,7 +513,7 @@ doc.h: $(HDR_FILES)
# Update existing po file or copy messages.pot # Update existing po file or copy messages.pot
# #
%.po:messages.pot %.po:messages.pot
if test -f $*.po; then \ $(v)if test -f $*.po; then \
msgmerge -U --backup=existing $*.po messages.pot;\ msgmerge -U --backup=existing $*.po messages.pot;\
else \ else \
cp messages.pot $*.po;\ cp messages.pot $*.po;\
@ -554,42 +557,43 @@ endif
# There ought to be something simpler. # There ought to be something simpler.
# #
share/man: $(HELP_SRC) lexicon_filter share/man: $(HELP_SRC) lexicon_filter
-mkdir share/man -$(v)mkdir -p share/man
echo " doxygen\t "$@ @echo " doxygen "$@
touch share/man $(v)touch share/man
-rm -Rf share/man/man1 -$(v)rm -Rf share/man/man1
PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| $(SED) "s/-.*//"` INPUT_FILTER=./lexicon_filter \ PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| $(SED) "s/-.*//"` INPUT_FILTER=./lexicon_filter \
./build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share
# #
# The build rules for installing/uninstalling fish # The build rules for installing/uninstalling fish
# #
check-legacy-binaries: check-legacy-binaries:
@SEQLOC=$(prefix)/bin/seq;\ $(v)SEQLOC=$(prefix)/bin/seq;\
if test -f "$$SEQLOC" && grep -q '\(^#!/.*/fish\|^#!/usr/bin/env fish\)' "$$SEQLOC"; then\ if test -f "$$SEQLOC" && grep -q '\(^#!/.*/fish\|^#!/usr/bin/env fish\)' "$$SEQLOC"; then\
echo "An outdated seq from a previous fish install was found. You should remove it with:";\ echo "An outdated seq from a previous fish install was found. You should remove it with:";\
echo " rm '$$SEQLOC'";\ echo " rm '$$SEQLOC'";\
fi; fi;
@SETCOLOR_LOC=$(prefix)/bin/set_color;\ $(v)SETCOLOR_LOC=$(prefix)/bin/set_color;\
if test -x "$$SETCOLOR_LOC" && $$SETCOLOR_LOC -v 2>&1 >/dev/null | grep -q "^set_color, version "; then\ if test -x "$$SETCOLOR_LOC" && $$SETCOLOR_LOC -v 2>&1 >/dev/null | grep -q "^set_color, version "; then\
echo "An outdated set_color from a previous fish install was found. You should remove it with:";\ echo "An outdated set_color from a previous fish install was found. You should remove it with:";\
echo " rm '$$SETCOLOR_LOC'";\ echo " rm '$$SETCOLOR_LOC'";\
fi; fi;
@MIMEDB_LOC=$(prefix)/bin/mimedb;\ $(v)MIMEDB_LOC=$(prefix)/bin/mimedb;\
if test -x "$$MIMEDB_LOC" && $$MIMEDB_LOC --version 2>&1 | grep -q "^mimedb, version "; then\ if test -x "$$MIMEDB_LOC" && $$MIMEDB_LOC --version 2>&1 | grep -q "^mimedb, version "; then\
echo "An outdated mimedb binary from a previous fish install was found. You should remove it with:";\ echo "An outdated mimedb binary from a previous fish install was found. You should remove it with:";\
echo " rm '$$MIMEDB_LOC'";\ echo " rm '$$MIMEDB_LOC'";\
fi; fi;
@FISHD_LOC=$(prefix)/bin/fishd;\ $(v)FISHD_LOC=$(prefix)/bin/fishd;\
if test -x "$$FISHD_LOC" && $$FISHD_LOC --version 2>&1 | grep -q "^fishd: fishd, version "; then\ if test -x "$$FISHD_LOC" && $$FISHD_LOC --version 2>&1 | grep -q "^fishd: fishd, version "; then\
echo "An outdated fishd binary from a previous fish install was found. You should remove it with:";\ echo "An outdated fishd binary from a previous fish install was found. You should remove it with:";\
echo " rm '$$FISHD_LOC'";\ echo " rm '$$FISHD_LOC'";\
fi; fi;
@true; $(v)true;
.PHONY: check-legacy-binaries .PHONY: check-legacy-binaries
install: all install-force check-legacy-binaries install: all install-force check-legacy-binaries
@echo
@echo fish is now installed on your system. @echo fish is now installed on your system.
@echo To run fish, type \'fish\' in your terminal. @echo To run fish, type \'fish\' in your terminal.
@echo @echo
@ -615,86 +619,86 @@ install: all install-force check-legacy-binaries
# Xcode install # Xcode install
# #
xcode-install: xcode-install:
rm -Rf /tmp/fish_build;\ $(v)rm -Rf /tmp/fish_build;\
xcodebuild install DSTROOT=/tmp/fish_build;\ xcodebuild install DSTROOT=/tmp/fish_build;\
ditto /tmp/fish_build / ditto /tmp/fish_build /
.PHONY: xcode-install .PHONY: xcode-install
# #
# Actually do the installation. These 'true' lines are to prevent installs # Actually do the installation. These 'true', ||: (OR noop) lines are to prevent installs
# from failing for (e.g.) missing man pages or extra_dirs outside the # from failing for (e.g.) missing man pages or extra_dirs outside the
# writeable prefix. # writeable prefix.
# #
install-force: all install-translations install-force: all install-translations
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\ $(v)for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \ $(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
true ;\ true ;\
done; done;
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish/conf.d $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish/conf.d
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
$(INSTALL) -m 755 -d $(DESTDIR)$(extra_completionsdir) || true $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_completionsdir) ||:
$(INSTALL) -m 755 -d $(DESTDIR)$(extra_functionsdir) || true $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_functionsdir) ||:
$(INSTALL) -m 755 -d $(DESTDIR)$(extra_confdir) || true $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_confdir) ||:
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1 $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/js $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/js
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/partials $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/partials
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts
$(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/ $(v)$(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/
$(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/ $(v)$(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/
$(INSTALL) -m 644 share/__fish_build_paths.fish $(DESTDIR)$(datadir)/fish/ $(v)$(INSTALL) -m 644 share/__fish_build_paths.fish $(DESTDIR)$(datadir)/fish/
$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig
$(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig $(v)$(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig
for i in $(COMPLETIONS_DIR_FILES:%='%'); do \ $(v)for i in $(COMPLETIONS_DIR_FILES:%='%'); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
true; \ true; \
done; done;
for i in $(FUNCTIONS_DIR_FILES:%='%'); do \ $(v)for i in $(FUNCTIONS_DIR_FILES:%='%'); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
true; \ true; \
done; done;
for i in share/man/man1/*.1; do \ $(v)for i in share/man/man1/*.1; do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/man/man1/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/man/man1/; \
true; \ true; \
done; done;
for i in share/tools/*.py; do\ $(v)for i in share/tools/*.py; do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/; \ $(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/; \
true; \ true; \
done; done;
for i in share/tools/web_config/*; do\ $(v)for i in share/tools/web_config/*.*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \
true; \ true; \
done; done;
for i in share/tools/web_config/js/*; do\ $(v)for i in share/tools/web_config/js/*.*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/js/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/js/; \
true; \ true; \
done; done;
for i in share/tools/web_config/partials/*; do\ $(v)for i in share/tools/web_config/partials/*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/partials/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/partials/; \
true; \ true; \
done; done;
for i in share/tools/web_config/sample_prompts/*.fish; do\ $(v)for i in share/tools/web_config/sample_prompts/*.fish; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts/; \
true; \ true; \
done; done;
for i in share/tools/web_config/*.py; do\ $(v)for i in share/tools/web_config/*.py; do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \ $(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \
true; \ true; \
done; done;
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir) $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* CHANGELOG.md; do \ $(v) for i in user_doc/html/* CHANGELOG.md; do \
if test -f $$i; then \ if test -f $$i; then \
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \ $(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
fi; \ fi; \
done; done;
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1 $(v)$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1;
for i in $(MANUALS); do \ $(v) for i in $(MANUALS); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \
true; \ true; \
done; done;
@ -704,27 +708,27 @@ install-force: all install-translations
# Uninstall this fish version # Uninstall this fish version
# #
uninstall: uninstall-translations uninstall: uninstall-translations
-for i in $(PROGRAMS); do \ -$(v) for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \ rm -f $(DESTDIR)$(bindir)/$$i; \
done; done;
-rm -rf $(DESTDIR)$(sysconfdir)/fish -$(v) rm -rf $(DESTDIR)$(sysconfdir)/fish
-if test -d $(DESTDIR)$(datadir)/fish; then \ -$(v) if test -d $(DESTDIR)$(datadir)/fish; then \
rm -r $(DESTDIR)$(datadir)/fish; \ rm -r $(DESTDIR)$(datadir)/fish; \
fi fi
-if test -d $(DESTDIR)$(docdir); then \ -$(v) if test -d $(DESTDIR)$(docdir); then \
rm -rf $(DESTDIR)$(docdir);\ rm -rf $(DESTDIR)$(docdir);\
fi fi
-if test -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc; then \ -$(v) if test -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc; then \
rm -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc;\ rm -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc;\
fi fi
-for i in $(MANUALS); do \ -$(v) for i in $(MANUALS); do \
rm -rf $(DESTDIR)$(mandir)/man1/`basename $$i`*; \ rm -rf $(DESTDIR)$(mandir)/man1/`basename $$i`*; \
done; done;
.PHONY: uninstall .PHONY: uninstall
install-translations: $(TRANSLATIONS) install-translations: $(TRANSLATIONS)
ifdef HAVE_GETTEXT ifdef HAVE_GETTEXT
for i in $(TRANSLATIONS); do \ $(v)for i in $(TRANSLATIONS); do \
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES; \ $(INSTALL) -m 755 -d $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
echo $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\ echo $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo;\
@ -733,7 +737,7 @@ endif
.PHONY: install-translations .PHONY: install-translations
uninstall-translations: uninstall-translations:
rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo $(v)rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo
.PHONY: uninstall-translations .PHONY: uninstall-translations
# #
@ -744,47 +748,47 @@ uninstall-translations:
# How basic files get compiled # How basic files get compiled
# #
obj/%.o: src/%.cpp | obj obj/%.o: src/%.cpp | obj
echo " CXX\t "$@ @echo " CXX "$@
$(CXX) $(CXXFLAGS) -c $< -o $@ $(CXX) $(CXXFLAGS) -c $< -o $@
# #
# obj directory # obj directory
# #
obj: obj:
mkdir obj $(v)mkdir obj
# #
# Build the fish program. # Build the fish program.
# #
fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2) fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2)
echo " CXXLD\t "$@ @echo " CXXLD "$@
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@ $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@
$(PCRE2_LIB): $(PCRE2_H) $(PCRE2_LIB): $(PCRE2_H)
$(MAKE) -C $(PCRE2_DIR) libpcre2-$(PCRE2_WIDTH).la $(v)$(MAKE) V=$(V) -C $(PCRE2_DIR) libpcre2-$(PCRE2_WIDTH).la
$(PCRE2_H): $(PCRE2_H):
(cd $(PCRE2_DIR) && ./config.status) $(v)(cd $(PCRE2_DIR) && ./config.status)
# #
# Build the fish_tests program. # Build the fish_tests program.
# #
fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2) fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2)
echo " CXXLD\t "$@ @echo " CXXLD "$@
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@ $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@
# #
# Build the fish_indent program. # Build the fish_indent program.
# #
fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2) fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2)
echo " CXXLD\t "$@ @echo " CXXLD "$@
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@
# #
# Build the fish_key_reader program to show input from the terminal. # Build the fish_key_reader program to show input from the terminal.
# #
fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2) fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2)
echo " CXXLD\t "$@ @echo " CXXLD "$@
$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@ $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@
# #
@ -799,23 +803,24 @@ fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2)
# behind. # behind.
# #
depend: depend:
mkdir -p /tmp/fish_make_depend/src @echo "Running makedepend..."
cp src/*.cpp src/*.h /tmp/fish_make_depend/src $(v)mkdir -p /tmp/fish_make_depend/src
cp config.h /tmp/fish_make_depend/ $(v)cp src/*.cpp src/*.h /tmp/fish_make_depend/src
mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/ $(v)cp config.h /tmp/fish_make_depend/
cd /tmp/fish_make_depend && \ $(v)mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/
$(v)cd /tmp/fish_make_depend && \
makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
rm -Rf /tmp/fish_make_depend $(v)rm -Rf /tmp/fish_make_depend
./config.status $(v)./config.status
.PHONY: depend .PHONY: depend
# #
# Lint the code. This only deals with C++ files. # Lint the code. This only deals with C++ files.
# #
lint: lint:
build_tools/lint.fish $(CXX) $(CXXFLAGS) $(v)build_tools/lint.fish $(CXX) $(CXXFLAGS)
lint-all: lint-all:
build_tools/lint.fish $(CXX) --all $(CXXFLAGS) $(v)build_tools/lint.fish $(CXX) --all $(CXXFLAGS)
.PHONY: lint lint-all .PHONY: lint lint-all
# #
@ -823,9 +828,9 @@ lint-all:
# fish scripts (*.fish). # fish scripts (*.fish).
# #
style: style:
build_tools/style.fish $(v)build_tools/style.fish
style-all: style-all:
build_tools/style.fish --all $(v)build_tools/style.fish --all
.PHONY: style style-all .PHONY: style style-all
# #
@ -836,8 +841,8 @@ style-all:
# Restore the source tree to the state right after extracting a tarball. # Restore the source tree to the state right after extracting a tarball.
# #
distclean: clean distclean: clean
$(MAKE) -C $(PCRE2_DIR) distclean || true $(v)$(MAKE) -C $(PCRE2_DIR) distclean ||:
rm -f config.status config.log config.h Makefile $(v)rm -f config.status config.log config.h Makefile
.PHONY: distclean .PHONY: distclean
# #
@ -849,24 +854,33 @@ distclean: clean
# them. # them.
# #
clean: clean:
$(call echo_bold, "Removing everything built by the Makefile") $(v)$(call echo_bold, "Removing everything built by the Makefile")
$(MAKE) -C $(PCRE2_DIR) clean || true $(v)$(MAKE) -s -C $(PCRE2_DIR) clean ||:
rm -f obj/*.o *.o doc.h doc.tmp $(v)rm -f obj/*.o *.o doc.h doc.tmp
rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr $(v)rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt $(v)rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
rm -f $(PROGRAMS) fish_tests fish_key_reader $(v)rm -f $(PROGRAMS) fish_tests fish_key_reader
rm -f command_list.txt command_list_toc.txt toc.txt $(v)rm -f command_list.txt command_list_toc.txt toc.txt
rm -f doc_src/index.hdr doc_src/commands.hdr $(v)rm -f doc_src/index.hdr doc_src/commands.hdr
rm -f lexicon_filter lexicon.txt lexicon.log $(v)rm -f lexicon_filter lexicon.txt lexicon.log
rm -f compile_commands.json xcodebuild.log $(v)rm -f compile_commands.json xcodebuild.log
rm -f FISH-BUILD-VERSION-FILE fish.pc share/__fish_build_paths.fish $(v)rm -f FISH-BUILD-VERSION-FILE fish.pc share/__fish_build_paths.fish
if test "$(HAVE_DOXYGEN)" = 1; then \ $(v)if test "$(HAVE_DOXYGEN)" = 1; then \
rm -rf doc user_doc share/man; \ rm -rf doc user_doc share/man; \
fi fi
rm -f po/*.gmo $(v)rm -f po/*.gmo
rm -rf obj build test $(v)rm -rf obj build test
.PHONY: clean .PHONY: clean
# Veto'd Verbose
# $(v)cmd = @cmd if V=0,
# cmd if V=1
# @cmd = @cmd always
V1 :=
V0 := @
v = $(V$(V))
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
obj/autoload.o: config.h src/autoload.h src/common.h src/fallback.h obj/autoload.o: config.h src/autoload.h src/common.h src/fallback.h