Makefile/configure: detect and use sed from configure

This commit is contained in:
David Adam 2014-09-18 20:29:49 +08:00
parent 708e21f929
commit 174f5ba99a
2 changed files with 17 additions and 16 deletions

View file

@ -32,6 +32,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
CXX := @CXX@ CXX := @CXX@
INSTALL:=@INSTALL@ INSTALL:=@INSTALL@
SED := @SED@
# #
@ -261,7 +262,7 @@ prof: all
user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter user_doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter
(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \ (cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \
echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | sed "s/-.*//") | doxygen - && touch user_doc; \ echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | doxygen - && touch user_doc; \
cd user_doc/html && rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html cd user_doc/html && rm -f bc_s.png bdwn.png closed.png ftv2*.png nav*.png open.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
# #
@ -339,7 +340,7 @@ toc.txt: $(HDR_FILES:index.hdr=index.hdr.in)
for i in $(HDR_FILES:index.hdr=index.hdr.in); do\ 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
@ -361,20 +362,20 @@ doc_src/index.hdr: toc.txt doc_src/index.hdr.in
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 lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@ -rm 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.
sed <command_list_toc.txt >>lexicon.tmp -n \ $(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 \
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | sed >>lexicon.tmp -n \ -e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
-e 'w lexicon_catalog.tmp' \ -e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|cmnd \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt; \ -e "s|'\(.*\)'|cmnd \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt; \
printf "%s\n" $(FUNCTIONS_DIR_FILES) | sed -n \ printf "%s\n" $(FUNCTIONS_DIR_FILES) | $(SED) -n \
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | sed >>lexicon.tmp -n \ -e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
-e 'w lexicon_catalog.tmp' \ -e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|func \1|p"; \ -e "s|'\(.*\)'|func \1|p"; \
sed <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \ $(SED) <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \ -e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
sed <lexicon_filter.in >>lexicon.tmp -n \ $(SED) <lexicon_filter.in >>lexicon.tmp -n \
-e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p'; \ -e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p'; \
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt; mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
@ -391,16 +392,15 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
lexicon_filter: lexicon.txt lexicon_filter.in lexicon_filter: lexicon.txt lexicon_filter.in
-rm $@.tmp $@ -rm $@.tmp $@
# Clean the filter input comments and set the shebang as sed can reside in # Set the shebang as sed can reside in multiple places.
# /bin or /usr/bin and some versions dont allow more than one comment!. $(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|'
sed <$@.in >$@.tmp -e 's|@sed@|'"`which sed`"'|' -e '/^[ ]*#[^!]/d'
# 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 \ if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \
WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \ WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \
else \ else \
WORDBL='\<'; WORDBR='\>'; \ WORDBL='\<'; WORDBR='\>'; \
fi; \ fi; \
sed <lexicon.txt >>$@.tmp -n \ $(SED) <lexicon.txt >>$@.tmp -n \
-e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \ -e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \
-e '$$G;s/.*\n/b tidy/p'; \ -e '$$G;s/.*\n/b tidy/p'; \
mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi
@ -428,7 +428,7 @@ doc.h: $(HDR_FILES)
echo "*/" >>$@ echo "*/" >>$@
%: %.in %: %.in
sed <$@.in >$@ \ $(SED) <$@.in >$@ \
-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 +510,7 @@ share/man: $(HELP_SRC) lexicon_filter
-mkdir share/man -mkdir share/man
touch share/man touch share/man
-rm -Rf share/man/man1 -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
# #

View file

@ -90,6 +90,7 @@ fi
AC_PROG_CXX([g++ c++]) AC_PROG_CXX([g++ c++])
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_SED
AC_LANG(C++) AC_LANG(C++)
echo "CXXFLAGS: $CXXFLAGS" echo "CXXFLAGS: $CXXFLAGS"