home *** CD-ROM | disk | FTP | other *** search
Makefile | 1990-01-06 | 6.2 KB | 354 lines |
- # Makefile - main GNU makefile for callback
- #
- # $Header: Makefile,v 1.2 89/12/28 10:37:29 howard Exp $
- #
- # Copyright 1990 Howard Lee Gayle
- # This file is written in the ISO 8859/1 character set.
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License version 1,
- # as published by the Free Software Foundation.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- #
-
- include MakeCommon
-
- # Commands:
-
- # Copy stdin to stdout.
- CAT=cat
-
- # Put a file into the distribution directory.
- DISTO=mkDistO
-
- # Echo arguments.
- ECHO=echo
-
- # Elisp compiler.
- ELCMP=emacs -batch -q -f batch-byte-compile
-
- # Install a non-executable file.
- INSTF=mkInstF
-
- # Install an executable file.
- INSTX=mkInstX
-
- # Lint command.
- LINT=lint
-
- # Make shar files.
- SHAR=trshar shar
-
-
- # Command options:
-
- # Set commands at start of Bourne shell files, usually absolute paths.
- BDEFS=
-
- # C compiler options.
- CFLAGS=-O4
-
- # C library search path.
- LIBPATH=-L/usr/local/free/howard/0
-
- # C libraries to link in.
- LIBES=-lhoward
-
- # Options to lint.
- LINTFLAGS=-abchux
-
- # Lint libraries.
- LL=/usr/local/free/howard/0/llib-howard.ln
-
-
- # Directories:
-
- # Install Bourne shell files here.
- BID=../bin
-
- # Install C executables here.
- CID=../bin
-
- # Install compiled elisp here.
- ELID=../el
-
- # Install man entries here.
- MID=../man
-
-
- # Sources. Comment out all that don't apply.
-
- # Bourne shell files.
- BS := $(filter %.b,$(SRCS))
-
- # BibTeX bibliography file.
- BIBS := $(filter %.bib,$(SRCS))
-
- # C programs.
- CS := $(filter %.c,$(SRCS))
-
- # Elisp source.
- ELS := $(filter %.el,$(SRCS))
-
- # C include files.
- HS := $(filter %.h,$(SRCS))
-
- # LaTeX source.
- LATEXS := $(filter %.tex,$(SRCS))
-
- # Manuals.
- M1S := $(filter %.1,$(SRCS))# Section 1.
- M5S := $(filter %.5,$(SRCS))# Section 5.
- M8S := $(filter %.8,$(SRCS))# Section 8.
- ms := $(M1S) $(M5S) $(M8S)# All sections.
-
- # All ordinary source files. Removed by make clobber.
- src := $(BS) $(BIBS) $(CS) $(ELS) $(HS) $(LATEXS) $(ms)
-
- # Absolutely all source files.
- allsrc := README FREEZE MakeCommon Makefile uMakefile $(src)
-
-
- # Targets and installs:
-
- # Bourne shell files.
- ifdef BS
- bt := $(subst .b,,$(BS))
- bi := $(patsubst %,$(BID)/%,$(bt))
- endif
-
- # C programs.
- ifdef CS
- ct := $(subst .c,,$(CS))
- ci := $(patsubst %,$(CID)/%,$(ct))
- lt := $(patsubst %.c,%-l,$(CS))# Phony lint targets for C programs.
- st := $(subst .c,.s,$(CS))# Assembler targets for C programs.
- endif
-
- # Compiled elisp.
- ifdef ELS
- elt := $(subst .el,.elc,$(ELS))
- eli := $(patsubst %,$(ELID)/%,$(elt))
- endif
-
- # LaTeX.
- ifdef FMTLATEX
- latext := $(subst .tex,.texf,$(LATEXS))
- spellt := $(patsubst %.tex,%-s,$(LATEXS))#Phony targets for spelling checking.
- endif
-
- # Manual entries.
- ifdef M1S
- cat1i := $(patsubst %,$(MID)/cat1/%,$(M1S))
- m1i := $(patsubst %,$(MID)/man1/%,$(M1S))
- endif
- ifdef M5S
- cat5i := $(patsubst %,$(MID)/cat5/%,$(M5S))
- m5i := $(patsubst %,$(MID)/man5/%,$(M5S))
- endif
- ifdef M8S
- cat8i := $(patsubst %,$(MID)/cat8/%,$(M8S))
- m8i := $(patsubst %,$(MID)/man8/%,$(M8S))
- endif
- cati := $(cat1i) $(cat5i) $(cat8i)
- mi := $(m1i) $(m5i) $(m8i)
-
- ifdef FMTMAN
- ft := $(patsubst %,%.f,$(ms))#Formatted manual entries, e.g. PostScript.
- endif
-
- targets := $(bt) $(ct) $(elt) $(ft) $(latext)
-
- # Distribution:
- dist := $(patsubst %,$(DD)/%,$(allsrc) $(ft) $(latext))
-
- # Don't use built-in rules.
- .SUFFIXES:
- .PHONY: clean clobber default dist install shar vars $(lt) $(spellt)
-
- default: $(targets)
-
- # Display values of various variables. Mostly for debugging.
- vars:
- @$(ECHO) 'SRCS:' $(SRCS)
- ifdef BS
- @$(ECHO) 'BS:' $(BS)
- @$(ECHO) 'bt:' $(bt)
- @$(ECHO) 'bi:' $(bi)
- endif
- ifdef CS
- @$(ECHO) 'CS:' $(CS)
- @$(ECHO) 'ct:' $(ct)
- @$(ECHO) 'ci:' $(ci)
- @$(ECHO) 'lt:' $(lt)
- @$(ECHO) 'st:' $(st)
- @$(ECHO) 'CC:' $(CC)
- @$(ECHO) 'CFLAGS:' $(CFLAGS)
- @$(ECHO) 'DEFS:' $(DEFS)
- @$(ECHO) 'LIBPATH:' $(LIBPATH)
- @$(ECHO) 'LIBES:' $(LIBES)
- endif
- ifdef ELS
- @$(ECHO) 'ELS:' $(ELS)
- @$(ECHO) 'elt:' $(elt)
- @$(ECHO) 'eli:' $(eli)
- endif
- ifdef HS
- @$(ECHO) 'HS:' $(HS)
- endif
- ifdef FMTLATEX
- @$(ECHO) 'LATEXS:' $(LATEXS)
- @$(ECHO) 'BIBS:' $(BIBS)
- @$(ECHO) 'latext:' $(latext)
- @$(ECHO) 'spellt:' $(spellt)
- endif
- ifdef M1S
- @$(ECHO) 'M1S:' $(M1S)
- @$(ECHO) 'cat1i:' $(cat1i)
- @$(ECHO) 'm1i:' $(m1i)
- endif
- ifdef M5S
- @$(ECHO) 'M5S:' $(M5S)
- @$(ECHO) 'cat5i:' $(cat5i)
- @$(ECHO) 'm5i:' $(m5i)
- endif
- ifdef M8S
- @$(ECHO) 'M8S:' $(M8S)
- @$(ECHO) 'cat8i:' $(cat8i)
- @$(ECHO) 'm8i:' $(m8i)
- endif
- @$(ECHO) 'mi:' $(mi)
- ifdef FMTMAN
- @$(ECHO) 'ft:' $(ft)
- endif
- @$(ECHO) 'allsrc:' $(allsrc)
- @$(ECHO) 'dist:' $(dist)
-
- clean:
- -$(RM) depend $(st)
-
- clobber: clean
- -$(RM) $(src) $(targets) FREEZE FREEZE.*
-
- ifdef BS
- $(bt): %: %.b
- $(RM) $@
- $(ECHO) ' $(BDEFS)' > $@
- $(CAT) $< >> $@
- $(CHMOD) +x $@
- endif
-
- ifdef CS
- $(ct): %: %.c
- $(CC) -o $@ $(CFLAGS) $(DEFS) $(INCLUDES) $(LIBPATH) $*.c $(LIBES)
-
- $(lt): %-l: %.c $(LL)
- $(LINT) $(LINTFLAGS) $(DEFS) $(INCLUDES) $< $(LL)
- endif
-
- ifdef ELS
- $(elt): %.elc: %.el
- $(ELCMP) $<
- endif
-
- ifdef FMTMAN
- $(ft): %.f: %
- $(RM) $@
- $(FMTMAN) $< > $@
- endif
-
- ifdef FMTLATEX
- $(latext): %.texf: %.tex $(BIBS)
- $(FMTLATEX) $* $@
-
- $(spellt): %-s: %.tex
- $(SPELL_LATEX) $<
- endif
-
- shar: $(allsrc)
- $(SHAR) $(allsrc)
-
- ifdef CS
- $(st): %.s: %.c
- $(CC) -S $(DEFS) $(INCLUDES) $<
- endif
-
- ifdef WORK
-
- dist: $(dist)
-
- $(dist): $(DD)/%: %
- $(DISTO) $< $(DD)
-
- .DEFAULT:
- $(UNCMPRS) $@
-
- else # WORK
-
- install: $(bi) $(ci) $(cati) $(eli) $(mi)
-
- ifdef BS
- $(bi): $(BID)/%: %
- $(INSTF) $< $(BID)
- endif
-
- ifdef CS
- $(ci): $(CID)/%: %
- $(INSTX) $< $(CID)
- endif
-
- ifdef ELS
- $(eli): $(ELID)/%: %
- $(INSTF) $< $(ELID)
- endif
-
- ifdef M1S
- $(m1i): $(MID)/man1/%: %
- $(INSTF) $< $(MID)/man1
-
- ifdef CATMAN
- $(cat1i): $(m1i)
- $(CATMAN) -M $(MID) 1
- endif
- endif
-
- ifdef M5S
- $(m5i): $(MID)/man5/%: %
- $(INSTF) $< $(MID)/man5
-
- ifdef CATMAN
- $(cat5i): $(m5i)
- $(CATMAN) -M $(MID) 5
- endif
- endif
-
- ifdef M8S
- $(m8i): $(MID)/man8/%: %
- $(INSTF) $< $(MID)/man8
-
- ifdef CATMAN
- $(cat8i): $(m8i)
- $(CATMAN) -M $(MID) 8
- endif
- endif
-
- $(allsrc): %: $(DD)/%
- $(DISTI) $@ $(DD)
-
- .DEFAULT:
- $(DISTI) $@ $(DD)
-
- endif # WORK
-
- ifdef CS
- include depend
- endif
-