blob: 5c5196e0b9a46e0f68f1a0c85d07c5654f813722 (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# SunPRO.mk 2.9.0 92/07/06 makefile for mff -- SunPRO version
# This Makefile uses some of the features of SunPRO(tm) make.
# This is because our network has a mixture of Sun-3s and Sun-4s,
# and I need to keep the binaries produced for each type of machine
# separate. With SunPRO make I can arrange for the binaries to be
# produced in subdirectories named after the architecture types.
# The predefined macro $(TARGET_ARCH) says which architecture is
# being used.
# make all
# to create progs in the subdirectory `arch`
# make install IBIN=/usr/local/bin OPT=-O4 LDFLAGS=-s
# to do "make all" and then copy progs into $(IBIN).
.KEEP_STATE:
ARCH=$(TARGET_ARCH:-%=%)
OBJ=$(ARCH)
BIN=$(OBJ)
SUFFIX=
# MACROS THAT GO INTO THE cc COMMAND
CC=gcc -Wall
OPT=-O
NDEBUG=-DNDEBUG
CFLAGS=$(OPT)
RCDIR=/mclab/pdc/lib
# RCDIR is the directory in which the "system-wide" rc.mff file is
# to be found.
# The default -- if the above line is commented out --
# is the value in config.h; by default /usr/local/lib.
CPPFLAGS=$(NDEBUG) $(MORECPPFLAGS)
LDFLAGS=
CP=cp -p
RM=rm -f
# Tell "make" how to do compilations
# -- removed Sun's silly -target option which confuses gcc.
COMPILE.c=$(CC) $(CFLAGS) $(CPPFLAGS) -c
LINK.c=$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
$(OBJ)/%$(SUFFIX).o: %.c
$(COMPILE.c) -o $@ $<
$(OBJ)/%.o: %.c
$(COMPILE.c) -o $@ $<
# Definitions used in maintaining the TeX file that will
# eventually accompany this:
MAKEINDEX=/usr/local/lib/tex/bin4/makeindex
MAKEINDEXFLAGS=-rl -s /mclab/pdc/tex/idx.makeindex
IBIN=/mclab/pdc/bin/$(ARCH)
ILIB=/mclab/pdc/lib/$(ARCH)
########################################################################
# PROGS
PROGS=mff.c searchpath.c
# source files for executables
LIBFILE=libargloop$(SUFFIX).a
LIB=$(OBJ)/$(LIBFILE)
.PRECIOUS: $(LIB)
MODULES=argloop.c al_file.c al_init.c \
findfile.c \
strword.c stritem.c strdup.c fgetword.c error.c
# source files for modules in the argloop library
all: $(PROGS:%.c=$(BIN)/%)
install: $(PROGS:%.c=$(IBIN)/%) install-lib
install-lib: $(ILIB)/$(LIBFILE)
# There is an implicit rule that cp's files into install directories
# Keywords that give certain macros different values:
debug:
$(MAKE) all SUFFIX=-g OPT=-g LDFLAGS= NDEBUG= "CC=gcc -Wall"
install-lib-g:
$(MAKE) install-lib \
SUFFIX=-g OPT=-g LDFLAGS= NDEBUG= "CC=gcc -Wall"
clean:
$(RM) *.ln *.o $(PROGS:.c=) $(OBJ)/* $(LIB)
MFF.o=$(OBJ)/mff$(SUFFIX).o $(OBJ)/assoc$(SUFFIX).o \
$(OBJ)/fx$(SUFFIX).o $(OBJ)/magstep$(SUFFIX).o
MFF.lib=$(LIB)
$(BIN)/mff: $(MFF.o) $(LIB)
$(LINK.c) -o $@ $(MFF.o) $(MFF.lib)
SEARCHPATH.o=$(OBJ)/searchpath$(SUFFIX).o
SEARCHPATH.lib=$(LIB)
$(BIN)/searchpath: $(SEARCHPATH.o) $(LIB)
$(LINK.c) -o $@ $(SEARCHPATH.o) $(SEARCHPATH.lib)
$(OBJ)/mff$(SUFFIX).o: mff.c stdc.h config.h xstdio.h argloop.h fatal.h \
searchpath.h assoc.h fx.h strmisc.h magstep.h \
version.h
$(OBJ)/assoc$(SUFFIX).o:assoc.c stdc.h config.h xstdio.h strmisc.h assoc.h
$(OBJ)/fx$(SUFFIX).o: fx.c stdc.h config.h xstdio.h fatal.h strmisc.h fx.h
$(OBJ)/magstep$(SUFFIX).o: magstep.c stdc.h config.h magstep.h
$(OBJ)/searchpath$(SUFFIX).o: searchpath.c xstdio.h stdc.h config.h \
searchpath.h
$(OBJ)/al_file.o: al_file.c config.h xstdio.h stdc.h strmisc.h argloop.h
$(OBJ)/al_init.o: al_init.c config.h xstdio.h stdc.h strmisc.h argloop.h
$(OBJ)/argloop.o: argloop.c config.h xstdio.h stdc.h strmisc.h argloop.h
$(OBJ)/error.o: error.c stdc.h config.h xstdio.h argloop.h fatal.h
$(OBJ)/fgetword.o: fgetword.c xstdio.h stdc.h config.h
$(OBJ)/findfile.o: findfile.c config.h strmisc.h stdc.h searchpath.h
$(OBJ)/strdup.o: strdup.c fatal.h stdc.h config.h strmisc.h
$(OBJ)/stritem.o: stritem.c strmisc.h stdc.h config.h
$(OBJ)/strword.o: strword.c strmisc.h stdc.h config.h
config.h: config.x
sed 's%/usr/local/lib%$(RCDIR)%' config.x > config.h
########################################################################
# LIBRARY
# source for modules that go in the library
$(LIB): $(LIB)($(MODULES:%.c=$(OBJ)/%.o))
# default rule
$(LIB)($(OBJ)/%.o): %.c
$(COMPILE.c) -o $% $<
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
ranlib $@
# I can't get @#$%& make to reliably ranlib after adding one or more
# modules, so I have to make it do so every time.
########################################################################
# LINT SECTION (moan, moan)
#
# sun's lint libraries often seem inconsistent with the manual pages
# and with reality.
#
# -n -lbsd -lm (BSD-compatibility check)
# -- sprintf is given return type int not char * (!!)
# -- void functions are given return type int
# -- toupper is not defined
# -lm -q (SunOS check)
# -- errno is not defined
CFILES=$(PROGS)
LINTFILES=$(PROGS:.c=.ln)
LINTFLAGS=-abh
LINTLIB=llib-lmff.ln
LINTLIBS=-n -lbsd -lm
#LINTLIBS=-q -lm
LINTGREP=egrep -v 'constant (argument to NOT|in conditional context)'
lint: lint-mff lint-searchpath
lint-%: %.c $(LINTLIB)
$(LINT.c) $*.c $(LINTLIB) $(LINTLIBS) | $(LINTGREP)
$(LINTLIB): $(MODULES:.c=.ln)
$(LINT.c) -Cmff $(MODULES)
########################################################################
# Mysterious definitions that manitain the (unfinished) docs:
DOC=mffman
$(DOC).dvi: $(DOC).ind $(DOC).tex
tex $(DOC)
$(DOC).ind: $(DOC).idx
$(MAKEINDEX) $(MAKEINDEXFLAGS) $(DOC)
$(DOC).idx: $(DOC).tex
tex $(DOC)
########################################################################
# implicit rules:
.SUFFIXES: .1 .3
$(IBIN)/%: $(BIN)/%
$(CP) $< $@
$(ILIB)/%: $(OBJ)/%
$(CP) $< $@
########################################################################
atari: atari/mff.1 atari/searchpath.1 atari/shar.1 atari/testfont.1 \
atari/argloop.3 atari/fatalf.3 atari/mff.3 atari/strword.3 \
atari/findfile.3 atari/stritem.3 atari/xmalloc.3
atari-clean:
rm atari/*.[13]
atari/%.1: man1/%.1
man2cat $< > $@
atari/%.3: man3/%.3
man2cat $< > $@
|