home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume10 / callback_hg / part01 / Makefile < prev    next >
Encoding:
Makefile  |  1990-01-06  |  6.2 KB  |  354 lines

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