summaryrefslogtreecommitdiff
path: root/support/flatten/makefile
blob: 664f65b7cd5707e36b1dc19b1a3e7e83e3da8bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# makefile for program flatten --- include all "include" files
#                                  into a LaTeX root file
#
##################### Change the following for your setup
# The compiler
CC = cc

# We use flex (or equivalent) to generate the lexer
LEX = flex
# and the options
LEXFLAGS = -v

# Libraries to be used
LIBS = -ll -lm

# The root directory for installation (e.g., /usr/local )
ROOTDIR = /proj/ltx/teTeX033

# Where to place the running code (e.g. /usr/local/bin )
BINDIR = ${ROOTDIR}/bin/sparc-sunos4.1.3

# Where to place the man page (e.g., /usr/local/man/man1 )
MANEXT = 1
MANDIR = ${ROOTDIR}/man/man${MANEXT}

# Just in case you want to change the name of the binary
# (and then you should also change the man page and documentation).
# So, do not change this.
PROG = flatten

# Where to place the user documentation (e.g., /usr/local/doc/flatten )
DOCDIR = ${ROOTDIR}/doc/${PROG}

# The file copy command (copy but do not delete original)
COPY = cp

# The file move command (move and delete original)
MOVE = mv

# The file delete command
DELETE = rm

# The make directory (hierarchy) command
MAKEDIR = mkdirhier

# The stream editor command
SED = sed

################### You should not have to change anything after this

# The object modules
OBJS = flatten.o getopt.o srchenv.o

# Link object code together into PROG
flatten : ${OBJS}
	${CC} -o ${PROG} ${OBJS} ${LIBS}

# Compile C source code into object code
flatten.o : flatten.c getopt.h srchenv.h
	${CC} -c flatten.c
getopt.o : getopt.c getopt.h
	${CC} -c getopt.c
srchenv.o : srchenv.c
	${CC} -c srchenv.c

# Generate C code via LEXing
flatten.c : flatten.l
	${LEX} ${LEXFLAGS} flatten.l
	${MOVE} lex.yy.c flatten.c

# Only call make install if BINDIR has been set
install : flatten
	${MAKEDIR} ${BINDIR}
	${COPY} ${PROG} ${BINDIR}

# Edit file man to replace DOCUMENTDIR by the actual directory
# where the user manual is to be placed.
# Then copy the man page to the proper place.
manpage :
	${SED} 's!DOCUMENTDIR!${DOCDIR}!' man > tman
	${MAKEDIR} ${MANDIR}
	${COPY} tman ${MANDIR}/${PROG}.${MANEXT}

# Copy the user manuals to the proper place
doc :
	${MAKEDIR} ${DOCDIR}
	${COPY} flatten.tex ${DOCDIR}/${PROG}.tex
	${COPY} flatten.ps ${DOCDIR}/${PROG}.ps

# Do everything except clean up
all : flatten install manpage doc

# Call make clean to remove object files and edited man page
clean :
	${DELETE} ${PROG}
	${DELETE} *.o
	${DELETE} tman