home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume8 / cz / part04 / Makefile < prev    next >
Makefile  |  1989-10-01  |  7KB  |  378 lines

  1. # Makefile - main GNU make file for cz
  2. #
  3. # $Header: Makefile,v 1.18 89/09/23 17:00:19 howard Exp $
  4. #
  5. # Copyright 1989 Howard Lee Gayle
  6. # This file is written in the ISO 8859/1 character set.
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License version 1,
  10. # as published by the Free Software Foundation.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. include MakeCommon
  22.  
  23. # Commands:
  24.  
  25. # Binary file encoder.
  26. ABE=abe
  27.  
  28. # Put a file into the distribution directory.
  29. DISTO=mkDistO
  30.  
  31. # Echo arguments.
  32. ECHO=echo
  33.  
  34. # Elisp compiler.
  35. ELCMP=emacs -batch -q -f batch-byte-compile
  36.  
  37. # Install a non-executable file.
  38. INSTF=mkInstF
  39.  
  40. # Install an executable file.
  41. INSTX=mkInstX
  42.  
  43. # Lint command.
  44. LINT=lint
  45.  
  46. # Make shar files.
  47. SHAR=makekit
  48.  
  49. # Spelling-check LaTeX source.
  50. SPELL_LATEX=mkSpellLT
  51.  
  52. # Command options:
  53.  
  54. # Make files immune to IBM.
  55. ABEFLAGS=+ebcdic
  56.  
  57. # Set commands at start of Bourne shell files, usually absolute paths.
  58. BDEFS='l=lpr'
  59.  
  60. # C compiler options.
  61. CFLAGS=-O4
  62.  
  63. # C library search path.
  64. LIBPATH=-L/usr/local/free/howard/0
  65.  
  66. # C libraries to link in.
  67. LIBES=-lhoward -lm
  68.  
  69. # Options to lint.
  70. LINTFLAGS=-abchux
  71.  
  72. # Lint libraries.
  73. LL=/usr/local/free/howard/0/llib-howard.ln
  74.  
  75.  
  76. # Directories:
  77.  
  78. # Install Bourne shell files here.
  79. BID=../bin
  80.  
  81. # Install C executables here.
  82. CID=../bin
  83.  
  84. # Install encoding files here.
  85. CODEID=../lib
  86.  
  87. # Install compiled elisp here.
  88. ELID=../el
  89.  
  90. # Install man entries here.
  91. MID=../man
  92.  
  93. # Install .ps files here.
  94. PSID=../lib
  95.  
  96. # Install .rc files here.  This must be an absolute path.
  97. RCID=/usr/local/free/cz/2/lib
  98.  
  99. # Install test texts here.
  100. TID=../test
  101.  
  102. # Install test PostScript files here.
  103. TPSID=../test
  104.  
  105. # Install trigram tables here.
  106. TTID=../lib
  107.  
  108. # Sources:
  109.  
  110. # Bourne shell files.
  111. BS := $(filter %.b,$(SRCS))
  112.  
  113. # BibTeX bibliography file.
  114. BIBS := $(filter %.bib,$(SRCS))
  115.  
  116. # Encoding files.
  117. CODES:=$(filter %.code,$(SRCS))
  118.  
  119. # C programs.
  120. CS := $(filter %.c,$(SRCS))
  121.  
  122. # Elisp source.
  123. ELS := $(filter %.el,$(SRCS))
  124.  
  125. # Frequency tables.
  126. FRS := $(filter %.fr,$(SRCS))
  127.  
  128. # C include files.
  129. HS := $(filter %.h,$(SRCS))
  130.  
  131. # LaTeX source.
  132. LATEXS := $(filter %.tex,$(SRCS))
  133.  
  134. # Manuals.
  135. M1S := $(filter %.1,$(SRCS))# Section 1.
  136. ms := $(M1S)
  137.  
  138. # M4 macro processor sources.  (Not manual entries for section 4.)
  139. M4S := $(filter %.m4,$(SRCS))
  140.  
  141. # M4 that will turn into PostScript.
  142. P4S := $(filter %.p4,$(SRCS))
  143.  
  144. # Cz command files.
  145. RCS := $(filter %.rc,$(SRCS))
  146.  
  147. # Test PostScript files.
  148. TPSS := $(filter %.ps,$(SRCS))
  149.  
  150. # Test texts.
  151. TS = 8859-1.t 8859-1-fox.t T-61.t char8-dec.t char8-hex.t char8-oct.t
  152.  
  153. # All ordinary source files.  Removed by make clobber.
  154. src := $(BS) $(BIBS) $(CODES) $(CS) $(ELS) $(FRS) $(HS) \
  155.        $(ms) $(M4S) $(P4S) $(RCS) $(LATEXS) $(TPSS) $(TS)
  156.  
  157. # Absolutely all source files.
  158. allsrc := README FREEZE MakeCommon Makefile uMakefile $(src)
  159.  
  160.  
  161. # Targets and installs:
  162.  
  163. # Bourne shell files.
  164. bt := $(subst .b,,$(BS))
  165. bi := $(patsubst %,$(BID)/%,$(bt))
  166.  
  167. # C programs.
  168. ct := $(subst .c,,$(CS))
  169. ci := $(patsubst %,$(CID)/%,$(ct))
  170. lt := $(patsubst %.c,%-l,$(CS))# Phony lint targets for C programs.
  171. st := $(subst .c,.s,$(CS))# Assembler targets for C programs.
  172.  
  173. # Encoding files.
  174. codei := $(patsubst %,$(CODEID)/%,$(CODES))
  175.  
  176. # Compiled elisp.
  177. elt := $(subst .el,.elc,$(ELS))
  178. eli := $(patsubst %,$(ELID)/%,$(elt))
  179.  
  180. # LaTeX.
  181. ifdef FMTLATEX
  182. latext := $(subst .tex,.texf,$(LATEXS))
  183. spellt := $(patsubst %.tex,%-s,$(LATEXS))#Phony targets for spelling checking.
  184. endif
  185.  
  186. # Manual entries.
  187. cat1i := $(patsubst %,$(MID)/cat1/%,$(M1S))
  188. m1i   := $(patsubst %,$(MID)/man1/%,$(M1S))
  189. cati  := $(cat1i)
  190. mi    := $(m1i)
  191.  
  192. # Formatted manual entries, e.g. PostScript.
  193. ifdef FMTMAN
  194. ft := $(patsubst %,%.f,$(ms))
  195. endif
  196.  
  197. # PostScript from M4.
  198. pst := $(subst .p4,.ps,$(P4S))
  199. psi := $(patsubst %,$(PSID)/%,$(pst))
  200.  
  201. # Control files.
  202. rci := $(patsubst %,$(RCID)/%,$(RCS))
  203.  
  204. # Test text.
  205. ti := $(patsubst %,$(TID)/%,$(TS))
  206.  
  207. # Test PostScript.
  208. tpsi := $(patsubst %,$(TPSID)/%,$(TPSS))
  209.  
  210. # Trigram tables.
  211. ttt =  dkus.tt seus.tt
  212. tti := $(patsubst %,$(TTID)/%,$(ttt))
  213.  
  214. targets := $(bt) $(ct) $(elt) $(ft) $(latext) $(pst) $(RCS) $(TPSS) $(TS) $(ttt)
  215.  
  216. # Distribution:
  217. dist := $(patsubst %,$(DD)/%,$(allsrc) $(ft) $(latext))
  218.  
  219. # Don't use built-in rules.
  220. .SUFFIXES:
  221. .PHONY: clean clobber default dist install shar vars $(lt) $(spellt)
  222.  
  223. default: $(targets)
  224.  
  225. vars:
  226.     @$(ECHO) 'SRCS:' $(SRCS)
  227.     @$(ECHO) 'BS:' $(BS)
  228.     @$(ECHO) 'CS:' $(CS)
  229.     @$(ECHO) 'CZS:' $(CZS)
  230.     @$(ECHO) 'ELS:' $(ELS)
  231.     @$(ECHO) 'HS:' $(HS)
  232.     @$(ECHO) 'M1S:' $(M1S)
  233.     @$(ECHO) 'P4S:' $(P4S)
  234.     @$(ECHO) 'RCS:' $(RCS)
  235.     @$(ECHO) 'allsrc:' $(allsrc)
  236.     @$(ECHO) 'bt:' $(bt)
  237.     @$(ECHO) 'ct:' $(ct)
  238.     @$(ECHO) 'elt:' $(elt)
  239.     @$(ECHO) 'ft:' $(ft)
  240.     @$(ECHO) 'lt:' $(lt)
  241.     @$(ECHO) 'pst:' $(pst)
  242.     @$(ECHO) 'st:' $(st)
  243.     @$(ECHO) 'CFLAGS:' $(CFLAGS)
  244.     @$(ECHO) 'DEFS:' $(DEFS)
  245.     @$(ECHO) 'dist:' $(dist)
  246.     @$(ECHO) 'ai:' $(ai)
  247.     @$(ECHO) 'bi:' $(bi)
  248.     @$(ECHO) 'cati:' $(cati)
  249.     @$(ECHO) 'm1i:' $(m1i)
  250.     @$(ECHO) 'psi:' $(psi)
  251.     @$(ECHO) 'rci:' $(rci)
  252.  
  253. clean:
  254.     -$(RM) depend $(st)
  255.  
  256. clobber: clean
  257.     -$(RM) $(src) $(targets) FREEZE FREEZE.*
  258.  
  259. $(bt): %: %.b
  260.     $(RM) $@
  261.     $(ECHO) '  $(BDEFS)' > $@
  262.     $(CAT) $< >> $@
  263.     $(CHMOD) +x $@
  264.  
  265. $(ct): %: %.c
  266.     $(CC) -o $@ $(CFLAGS) $(DEFS) -DDEFPATH='"'$(RCID)'"' $(INCLUDES) \
  267.         $(LIBPATH) $*.c $(LIBES)
  268.  
  269. $(elt): %.elc: %.el
  270.     $(ELCMP) $<
  271.  
  272. $(lt): %-l: %.c $(LL)
  273.     $(LINT) $(LINTFLAGS) $(DEFS) -DDEFPATH='"'$(RCID)'"' $(INCLUDES) $< \
  274.         $(LL)
  275.  
  276. ifdef FMTMAN
  277. $(ft): %.f: %
  278.     $(RM) $@
  279.     $(FMTMAN) $< > $@
  280. endif
  281.  
  282. ifdef FMTLATEX
  283. $(latext): %.texf: %.tex $(BIBS)
  284.     $(FMTLATEX) $* $@
  285.  
  286. $(spellt): %-s: %.tex
  287.     $(SPELL_LATEX) $<
  288. endif
  289.  
  290. $(pst): %.ps: %.p4 ps-abbrev.m4
  291.     $(M4) $*.p4 | \
  292.         $(SED) -e 's;%.*;;' \
  293.         -e 's;    ; ;g' \
  294.         -e 's;^  *;;' \
  295.         -e 's;  *$$;;' \
  296.         -e 's;  *; ;g' \
  297.         -e '/^$$/d' > $@
  298.  
  299. dkus.tt: 78freq2tt dkus.code dk.fr us.fr
  300.     $(RM) $@
  301.     ./78freq2tt -d dkus.code dk.fr us.fr $@
  302.  
  303. seus.tt: 78freq2tt seus.code se.fr us.fr
  304.     $(RM) $@
  305.     ./78freq2tt -d seus.code se.fr us.fr $@
  306.  
  307. shar: $(allsrc)
  308.     $(RM) test.abe
  309.     $(ABE) $(ABEFLAGS) $(TS) > test.abe
  310.     $(SHAR) README FREEZE MakeCommon Makefile uMakefile \
  311.         $(BS) $(BIBS) $(CODES) $(CS) $(ELS) $(FRS) $(HS) \
  312.         $(ms) $(M4S) $(P4S) $(RCS) $(LATEXS) $(TPSS) test.abe
  313.  
  314. $(st): %.s: %.c
  315.     $(CC) -S $(DEFS) -DDEFPATH='"'$(RCID)'"' $(INCLUDES) $<
  316.  
  317. ifdef WORK
  318.  
  319. dist: $(dist)
  320.  
  321. $(dist): $(DD)/%: %
  322.     $(DISTO) $< $(DD)
  323.  
  324. .DEFAULT:
  325.     $(UNCMPRS) $@
  326.  
  327. else # WORK
  328.  
  329. install: $(bi) $(ci) $(cati) $(codei) $(eli) $(mi) $(psi) \
  330.          $(rci) $(ti) $(tpsi) $(tti)
  331.  
  332. $(bi): $(BID)/%: %
  333.     $(INSTF) $< $(BID)
  334.  
  335. $(ci): $(CID)/%: %
  336.     $(INSTX) $< $(CID)
  337.  
  338. $(codei): $(CODEID)/%: %
  339.     $(INSTF) $< $(CODEID)
  340.  
  341. $(m1i): $(MID)/man1/%: %
  342.     $(INSTF) $< $(MID)/man1
  343.  
  344. ifdef CATMAN
  345. $(cat1i): $(m1i)
  346.     $(CATMAN) -M $(MID) 1
  347. endif
  348.  
  349. $(eli): $(ELID)/%: %
  350.     $(INSTF) $< $(ELID)
  351.  
  352. $(psi): $(PSID)/%: %
  353.     $(INSTF) $< $(PSID)
  354.  
  355. $(rci): $(RCID)/%: %
  356.     $(INSTF) $< $(RCID)
  357.  
  358. $(ti): $(TID)/%: %
  359.     $(INSTF) $< $(TID)
  360.  
  361. $(tpsi): $(TPSID)/%: %
  362.     $(INSTF) $< $(TPSID)
  363.  
  364. $(tti): $(TTID)/%: %
  365.     $(INSTF) $< $(TTID)
  366.  
  367. $(allsrc): %: $(DD)/%
  368.     $(DISTI) $@ $(DD)
  369.  
  370. .DEFAULT:
  371.     $(DISTI) $@ $(DD)
  372.  
  373. endif # WORK
  374.  
  375. 8859-1.ps: 8859-1.m4
  376. T-61.ps: T-61.m4
  377. include depend
  378.