home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / manual / Makefile < prev    next >
Encoding:
Makefile  |  1993-05-22  |  4.8 KB  |  182 lines

  1. # Makefile for the GNU C Library manual.
  2.  
  3. # Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5.  
  6. # The GNU C Library is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public License
  8. # as published by the Free Software Foundation; either version 2 of
  9. # the License, or (at your option) any later version.
  10.  
  11. # The GNU C Library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with the GNU C Library; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20.  
  21. export subdir := manual
  22.  
  23. .PHONY: all dvi info
  24. all: dvi info
  25. dvi: libc.dvi
  26. info: libc.info
  27.  
  28. # Get glibc's configuration info.
  29. ifneq (,$(wildcard ../Makeconfig))
  30. include ../Makeconfig
  31. endif
  32.  
  33. # Set chapters and chapters-incl.
  34. include $(objpfx)chapters
  35. $(objpfx)chapters: libc.texinfo
  36.     $(find-includes)
  37. chapters := $(filter-out summary.texi,$(chapters))
  38. ifdef chapters
  39. include $(objpfx)chapters-incl
  40. $(objpfx)chapters-incl: $(chapters)
  41.     $(find-includes)
  42. endif
  43.  
  44. define find-includes
  45. (echo '$(@F) :=' \\    ;\
  46.  awk '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
  47. mv $@.new $@
  48. endef
  49.  
  50. $(objpfx)libc.dvi $(objpfx)libc.info: $(chapters) summary.texi $(chapters-incl)
  51. $(objpfx)libc.dvi: texinfo.tex
  52.  
  53. $(objpfx)%.info: %.texinfo
  54.     $(MAKEINFO) $< -o $@
  55. $(objpfx)%.dvi: %.texinfo
  56.     $(TEXI2DVI) $<
  57.  
  58. # Generate the summary from the Texinfo source files for each chapter.
  59. $(objpfx)summary.texi: stamp-summary ;
  60. $(objpfx)stamp-summary: summary.awk $(chapters)
  61.     awk -f $^ \
  62.     | sort +1 -2 | tr '\014' '\012' > summary-tmp
  63.     ./move-if-change summary-tmp $(objpfx)summary.texi
  64. # touch is broken on our machines.  Sigh.
  65.     date > $@
  66.  
  67. # Generate Texinfo files from the C source for the example programs.
  68. $(objpfx)%.c.texi: examples/%.c
  69.     sed -e 's,[{}],@&,g'                \
  70.         -e 's,/\*\(@.*\)\*/,\1,g'            \
  71.         -e 's,/\* *\(.*\) *\*/,/* @r{\1} */,g'    \
  72.         -e 's/\(@[a-z][a-z]*\)@{\([^}]*\)@}/\1{\2}/'\
  73.         $< > $@.new
  74.     mv $@.new $@
  75.  
  76.  
  77. minimal-dist = COPYING.LIB summary.awk move-if-change            \
  78.            libc.texinfo $(chapters)                    \
  79.            $(patsubst %.c.texi,examples/%.c,            \
  80.               $(filter-out summary.texi,$(chapters-incl)))
  81. doc-only-dist = Makefile mkinstalldirs
  82. distribute = $(minimal-dist)                               \
  83.          $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c,    \
  84.             $(minimal-dist)))                \
  85.          libc.?? libc.??s texinfo.tex summary.texi            \
  86.          stamp-summary chapters chapters-incl
  87. export distribute := $(distribute)
  88.  
  89. tar-it = tar chovf $@ $^
  90.  
  91. manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
  92. mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
  93.  
  94. edition := $(shell sed -n 's/^@set EDITION \(.*\)$$/\1/p' libc.texinfo)
  95.  
  96. glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
  97.     @rm -f glibc-doc-$(edition)
  98.     ln -s . glibc-doc-$(edition)
  99.     tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
  100.     rm -f glibc-doc-$(edition)
  101.  
  102. %.Z: %
  103.     compress -c $< > $@.new
  104.     mv $@.new $@
  105. %.z: %
  106.     gzip -9 -c $< > $@.new
  107.     mv $@.new $@
  108. %.uu: %
  109.     uuencode $< < $< > $@.new
  110.     mv $@.new $@
  111.  
  112. .PHONY: mostlyclean distclean realclean clean subdir_clean
  113. subdir_clean: clean
  114. distclean clean: mostlyclean
  115. mostlyclean:
  116.     -rm -f $(addprefix $(objpfx),libc.dvi libc.info*)
  117. realclean: clean
  118.     -rm -f $(addprefix $(objpfx),chapters chapters-incl \
  119.                      summary.texi stamp-summary \
  120.                      *.c.texi)
  121.  
  122. .PHONY: install subdir_install installdirs
  123. subdir_install: install
  124. install: $(infodir)/libc.info
  125.  
  126. ifndef infodir
  127. infodir = $(prefix)/info
  128. endif
  129. ifndef prefix
  130. prefix = /usr/local
  131. endif
  132.  
  133. ifndef INSTALL_DATA
  134. INSTALL_DATA = $(INSTALL) -m 644
  135. endif
  136. ifndef INSTALL
  137. INSTALL = install
  138. endif
  139.  
  140. $(infodir)/libc.info: $(objpfx)libc.info installdirs
  141.     for file in $<*; do \
  142.       name=`basename $$file`; \
  143.       $(INSTALL_DATA) $$file \
  144.         `echo $@ | sed "s,$(<F)\$$,$$name,"`; \
  145.     done
  146.  
  147. installdirs: $(firstword $(wildcard mkinstalldirs ../mkinstalldirs))
  148.     $(dir $<)$(notdir $<) $(infodir)
  149.  
  150. .PHONY: dist
  151. dist: glibc-doc-$(edition).tar.z
  152.  
  153. ifneq (,$(wildcard ../Make-dist))
  154. dist: ../Make-dist
  155.     $(MAKE) -f $< $(Make-dist-args)
  156. endif
  157.  
  158. ifndef ETAGS
  159. ETAGS = etags -T
  160. endif
  161. TAGS: $(minimal-dist)
  162.     $(ETAGS) -o $@ $^
  163.  
  164. # These are targets that each glibc subdirectory is expected to understand.
  165. # ../Rules defines them for code subdirectories; for us, they are no-ops.
  166. glibc-targets    := subdir_lib objects objs others tests subdir_lint.out \
  167.            subdir_echo-headers subdir_echo-distinfo stubs
  168. .PHONY: $(glibc-targets)
  169. $(glibc-targets):
  170.  
  171. stubs: $(common-objpfx)stub-manual
  172. $(common-objpfx)stub-manual:
  173.     cp /dev/null $@
  174.  
  175.  
  176. # Get rid of these variables if they came from the parent.
  177. routines =
  178. aux =
  179. sources =
  180. objects =
  181. headers =
  182.