Blame manual/Makefile

Packit 6c4009
# Copyright (C) 1992-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
# Makefile for the GNU C Library manual.
Packit 6c4009
Packit 6c4009
subdir := manual
Packit 6c4009
Packit 6c4009
include ../Makeconfig
Packit 6c4009
Packit 6c4009
.PHONY: dvi pdf info html
Packit 6c4009
Packit 6c4009
dvi: $(objpfx)libc.dvi
Packit 6c4009
pdf: $(objpfx)libc.pdf
Packit 6c4009
Packit 6c4009
TEXI2DVI = texi2dvi
Packit 6c4009
TEXI2PDF = texi2dvi --pdf
Packit 6c4009
Packit 6c4009
ifneq ($(strip $(MAKEINFO)),:)
Packit 6c4009
info: $(objpfx)libc.info
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
chapters = $(addsuffix .texi, \
Packit 6c4009
		       intro errno memory ctype string charset locale	\
Packit 6c4009
		       message search pattern io stdio llio filesys	\
Packit 6c4009
		       pipe socket terminal syslog math arith time	\
Packit 6c4009
		       resource setjmp signal startup process ipc job	\
Packit 6c4009
		       nss users sysinfo conf crypt debug threads	\
Packit 6c4009
		       probes tunables)
Packit 6c4009
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
Packit 6c4009
	     contrib.texi
Packit 6c4009
licenses = freemanuals.texi lgpl-2.1.texi fdl-1.3.texi
Packit 6c4009
Packit 6c4009
-include $(objpfx)texis
Packit 6c4009
$(objpfx)texis: texis.awk $(chapters) $(appendices) $(licenses)
Packit 6c4009
	$(make-target-directory)
Packit 6c4009
	$(AWK) -f $^ > $@.T
Packit 6c4009
	mv -f $@.T $@
Packit 6c4009
Packit 6c4009
nonexamples = $(filter-out %.c.texi, $(texis))
Packit 6c4009
examples = $(filter %.c.texi, $(texis))
Packit 6c4009
Packit 6c4009
# Generated files directly included from libc.texinfo.
Packit 6c4009
libc-texi-generated = chapters.texi top-menu.texi dir-add.texi \
Packit 6c4009
		      libm-err.texi version.texi pkgvers.texi
Packit 6c4009
Packit 6c4009
# Add path to build dir for generated files
Packit 6c4009
texis-path := $(filter-out $(libc-texi-generated) summary.texi $(examples), \
Packit 6c4009
				$(texis)) 				    \
Packit 6c4009
	 $(addprefix $(objpfx),$(filter $(libc-texi-generated) summary.texi \
Packit 6c4009
					$(examples), $(texis)))
Packit 6c4009
Packit 6c4009
# Kludge: implicit rule so Make knows the one command does it all.
Packit 6c4009
chapters.% top-menu.%: libc-texinfo.sh $(texis-path) Makefile
Packit 6c4009
	AWK=$(AWK) $(SHELL) $< $(objpfx) \
Packit 6c4009
				'$(chapters)' \
Packit 6c4009
			       '$(appendices) $(licenses)'
Packit 6c4009
Packit 6c4009
Packit 6c4009
$(objpfx)libc.dvi $(objpfx)libc.pdf $(objpfx)libc.info: \
Packit 6c4009
	$(addprefix $(objpfx),$(libc-texi-generated))
Packit 6c4009
$(objpfx)libc.dvi $(objpfx)libc.pdf: texinfo.tex
Packit 6c4009
Packit 6c4009
html: $(objpfx)libc/index.html
Packit 6c4009
$(objpfx)libc/index.html: $(addprefix $(objpfx),$(libc-texi-generated))
Packit 6c4009
	$(MAKEINFO) -P $(objpfx) -o $(objpfx)libc --html libc.texinfo
Packit 6c4009
Packit 6c4009
# Generate the summary from the Texinfo source files for each chapter.
Packit 6c4009
$(objpfx)summary.texi: $(objpfx)stamp-summary ;
Packit 6c4009
$(objpfx)stamp-summary: summary.pl $(filter-out $(objpfx)summary.texi, \
Packit 6c4009
					$(texis-path))
Packit 6c4009
	$(SHELL) ./check-safety.sh $(filter-out $(objpfx)%, $(texis-path))
Packit 6c4009
	LC_ALL=C $(PERL) $^ > $(objpfx)summary-tmp
Packit 6c4009
	$(move-if-change) $(objpfx)summary-tmp $(objpfx)summary.texi
Packit 6c4009
	touch $@
Packit 6c4009
Packit 6c4009
# Generate a file which can be added to the `dir' content to provide direct
Packit 6c4009
# access to the documentation of the function, variables, and other
Packit 6c4009
# definitions.
Packit 6c4009
$(objpfx)dir-add.texi: xtract-typefun.awk $(texis-path)
Packit 6c4009
	(echo "@dircategory GNU C library functions and macros";	\
Packit 6c4009
	 echo "@direntry";						\
Packit 6c4009
	 $(AWK) -f $^ | sort;						\
Packit 6c4009
	 echo "@end direntry") > $@.new
Packit 6c4009
	mv -f $@.new $@
Packit 6c4009
Packit 6c4009
# The table with the math errors is generated.
Packit 6c4009
$(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
Packit 6c4009
$(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
Packit 6c4009
						     $(dir)/libm-test-ulps))
Packit 6c4009
	pwd=`pwd`; \
Packit 6c4009
	$(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
Packit 6c4009
	$(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
Packit 6c4009
	touch $@
Packit 6c4009
Packit 6c4009
# Package version and bug reporting URL.
Packit 6c4009
$(objpfx)pkgvers.texi: $(objpfx)stamp-pkgvers ;
Packit 6c4009
$(objpfx)stamp-pkgvers: $(common-objpfx)config.make
Packit 6c4009
	echo "@ifclear PKGVERS" > $(objpfx)pkgvers-tmp
Packit 6c4009
	echo "@set PKGVERS" >> $(objpfx)pkgvers-tmp
Packit 6c4009
	echo "@set PKGVERSION $(PKGVERSION_TEXI)" >> $(objpfx)pkgvers-tmp
Packit 6c4009
	if [ "$(PKGVERSION_TEXI)" = "(GNU libc) " ]; then \
Packit 6c4009
	  echo "@set PKGVERSION_DEFAULT" >> $(objpfx)pkgvers-tmp; \
Packit 6c4009
	fi
Packit 6c4009
	echo "@set REPORT_BUGS_TO $(REPORT_BUGS_TEXI)" >> $(objpfx)pkgvers-tmp
Packit 6c4009
	echo "@end ifclear" >> $(objpfx)pkgvers-tmp
Packit 6c4009
	$(move-if-change) $(objpfx)pkgvers-tmp $(objpfx)pkgvers.texi
Packit 6c4009
	touch $@
Packit 6c4009
Packit 6c4009
# Generate a file with the version number.
Packit 6c4009
$(objpfx)version.texi: $(objpfx)stamp-version ;
Packit 6c4009
$(objpfx)stamp-version: $(common-objpfx)config.make
Packit 6c4009
	echo "@set VERSION $(version)" > $(objpfx)version-tmp
Packit 6c4009
	$(move-if-change) $(objpfx)version-tmp $(objpfx)version.texi
Packit 6c4009
	touch $@
Packit 6c4009
Packit 6c4009
# Generate Texinfo files from the C source for the example programs.
Packit 6c4009
$(objpfx)%.c.texi: examples/%.c
Packit 6c4009
	sed -e '1,/^\*\/$$/d'				\
Packit 6c4009
	    -e 's,[{}],@&,g'				\
Packit 6c4009
	    -e 's,/\*\(@.*\)\*/,\1,g'			\
Packit 6c4009
	    -e 's,/\*  *,/* @r{,g' -e 's,  *\*/,} */,'	\
Packit 6c4009
	    -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/g'\
Packit 6c4009
	    $< | expand > $@.new
Packit 6c4009
	mv -f $@.new $@
Packit 6c4009
Packit 6c4009
$(objpfx)%.info: %.texinfo
Packit 6c4009
	LANGUAGE=C LC_ALL=C $(MAKEINFO) -P $(objpfx) --output=$@ $<
Packit 6c4009
Packit 6c4009
$(objpfx)%.dvi: %.texinfo
Packit 6c4009
	cd $(objpfx);$(TEXI2DVI) -I $(shell cd $(
Packit 6c4009
				$(shell cd $(
Packit 6c4009
Packit 6c4009
$(objpfx)%.pdf: %.texinfo
Packit 6c4009
	cd $(objpfx);$(TEXI2PDF) -I $(shell cd $(
Packit 6c4009
				$(shell cd $(
Packit 6c4009
Packit 6c4009
Packit 6c4009
# Distribution.
Packit 6c4009
minimal-dist = summary.pl texis.awk tsort.awk libc-texinfo.sh libc.texinfo \
Packit 6c4009
	       libm-err.texi stamp-libm-err check-safety.sh		    \
Packit 6c4009
	       $(filter-out summary.texi, $(nonexamples))		    \
Packit 6c4009
	       $(patsubst %.c.texi,examples/%.c, $(examples))
Packit 6c4009
Packit 6c4009
indices = cp fn pg tp vr ky
Packit 6c4009
generated-dirs += libc
Packit 6c4009
generated += libc.dvi libc.pdf libc.tmp libc.info*			      \
Packit 6c4009
	     stubs							      \
Packit 6c4009
	     texis summary.texi stamp-summary *.c.texi			      \
Packit 6c4009
	     $(foreach index,$(indices),libc.$(index) libc.$(index)s)	      \
Packit 6c4009
	     libc.log libc.aux libc.toc					      \
Packit 6c4009
	     $(libc-texi-generated)					      \
Packit 6c4009
	     stamp-libm-err stamp-version
Packit 6c4009
Packit 6c4009
include ../Rules
Packit 6c4009
Packit 6c4009
.PHONY: install subdir_install install-data
Packit 6c4009
install-data subdir_install: install
Packit 6c4009
# Generated files requiring perl: libm-err.texi, summary.texi
Packit 6c4009
ifneq ($(PERL),no)
Packit 6c4009
ifneq ($(strip $(MAKEINFO)),:)
Packit 6c4009
install: $(inst_infodir)/libc.info
Packit 6c4009
	@if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
Packit 6c4009
	 test -f $(inst_infodir)/dir || $(INSTALL_DATA) dir $(inst_infodir);\
Packit 6c4009
	 $(INSTALL_INFO) --info-dir=$(inst_infodir) $(inst_infodir)/libc.info;\
Packit 6c4009
	else : ; fi
Packit 6c4009
endif
Packit 6c4009
endif
Packit 6c4009
# Catchall implicit rule for other installation targets from the parent.
Packit 6c4009
install-%: ;
Packit 6c4009
Packit 6c4009
$(inst_infodir)/libc.info: $(objpfx)libc.info
Packit 6c4009
	$(make-target-directory)
Packit 6c4009
	for file in $<*; do \
Packit 6c4009
	  $(INSTALL_DATA) $$file $(@D)/; \
Packit 6c4009
	done
Packit 6c4009
Packit 6c4009
TAGS: $(minimal-dist)
Packit 6c4009
	$(ETAGS) -o $@ $^