blob: 6028f3927db38507ee177bac79b2349e1c588c44 (
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# Copyright (c) 1993-1994 Mats O Jansson, Stockholm, Sweden
# All rights reserved.
#
# @(#) $OpenBSD: Makefile,v 1.4 2002/06/10 21:05:25 maja Exp $
# Script (or program) that returns the machine and os types,
# or jsut edit in the name yourself.
MD=`./mdtype`
OS=`./ostype`
REL=`cat ../common/VERSION`
CCOPT = -O
INCLUDES = -I..
#rs6000-aix3#DEFINES = -D_AIX -D_BSD
#mopchk#SPEC_FLAGS= -DINFO -DNODL -DNOAOUT
#mopd#SPEC_FLAGS= -DNOAOUT
#mopprobe#SPEC_FLAGS= -DNODL
#moptrace#SPEC_FLAGS=
# Standard CFLAGS
STANDARD_CFLAGS = $(CCOPT) $(SPEC_FLAGS) $(DEFINES) $(INCLUDES)
# CFLAGS definitions per machine vs. os
#sun3-sunos4#CFLAGS = $(STANDARD_CFLAGS)
#sun4-sunos4#CFLAGS = $(STANDARD_CFLAGS)
#sun4-sunos5#CFLAGS = $(STANDARD_CFLAGS) -DDLPIPF
#rs6000-aix3#CFLAGS = $(STANDARD_CFLAGS)
#alpha-linux2#CFLAGS = $(STANDARD_CFLAGS)
#i386-linux2#CFLAGS = $(STANDARD_CFLAGS)
#sparc-linux2#CFLAGS = $(STANDARD_CFLAGS)
#sun4-sunos5#LIB = -lsocket
INSTBIN="#"
INSTMAN="#"
#alpha-linux2#INSTBIN= install -c -s -o root -g root -m 755
#alpha-linux2#INSTMAN= install -c -o root -g root -m 644
#i386-linux2#INSTBIN= install -c -s -o root -g root -m 755
#i386-linux2#INSTMAN= install -c -o root -g root -m 644
#sparc-linux2#INSTBIN= install -c -s -o root -g root -m 755
#sparc-linux2#INSTMAN= install -c -o root -g root -m 644
# Change these to cc/lex/yacc if you don't have gcc, flex and/or bison.
CC = cc
LEX = lex
YACC = yacc -y
MAKE = make
# Explicitly define compiliation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.c.o:
rm -f $@; $(CC) $(CFLAGS) -c $*.c
DIRS= mopchk mopd mopprobe moptrace
CHDOC= mopchk.1
CHFIL= mopchk.c
CHOBJ= mopchk.o
CHHDR=
LDDOC= mopd.8
LDFIL= mopd.c process.c
LDOBJ= mopd.o process.o
LDHDR= process.h
PBDOC= mopprobe.1
PBFIL= mopprobe.c
PBOBJ= mopprobe.o
PBHDR=
TRDOC= moptrace.1
TRFIL= moptrace.c
TROBJ= moptrace.o
TRHDR=
#sun3-sunos4#OSHDR= os-sunos4.h
#sun3-sunos4#PFFIL= pf-snit.c
#sun3-sunos4#LOOP= loop.c
#sun4-sunos4#OSHDR= os-sunos4.h
#sun4-sunos4#PFFIL= pf-snit.c
#sun4-sunos4#LOOP= loop.c
#rs6000-aix3#OSHDR= os-aix3.h
#rs6000-aix3#PFFIL= pf-aix3.c
#rs6000-aix3#LOOP= loop.c
#alpha-linux2#OSHDR= os-linux2.h
#alpha-linux2#PFFIL= pf-linux2.c
#alpha-linux2#LOOP= loop-linux2.c
#i386-linux2#OSHDR= os-linux2.h
#i386-linux2#PFFIL= pf-linux2.c
#i386-linux2#LOOP= loop-linux2.c
#sparc-linux2#OSHDR= os-linux2.h
#sparc-linux2#PFFIL= pf-linux2.c
#sparc-linux2#LOOP= loop-linux2.c
#mopchk#COFIL= device.c file.c mopdef.c
#mopchk#COOBJ= device.o file.o mopdef.o
#mopchk#OTOBJ= pf.o loop.o
#mopchk#MANDIR=man1
#mopd#COFIL= cmp.c device.c dl.c file.c get.c mopdef.c nma.c print.c put.c rc.c
#mopd#COOBJ= cmp.o device.o dl.o file.o get.o mopdef.o nma.o print.o put.o rc.o
#mopd#OTOBJ= pf.o loop.o
#mopd#MANDIR=man8
#mopprobe#COFIL= cmp.c device.c get.c mopdef.c nma.c print.c
#mopprobe#COOBJ= cmp.o device.o get.o mopdef.o nma.o print.o
#mopprobe#OTOBJ= pf.o loop.o
#mopprobe#MANDIR=man1
#moptrace#COFIL= cmp.c device.c dl.c get.c mopdef.c nma.c print.c rc.c
#moptrace#COOBJ= cmp.o device.o dl.o get.o mopdef.o nma.o print.o rc.o
#moptrace#OTOBJ= pf.o loop.o
#moptrace#MANDIR=man1
toplvl: osmake
oslvl: submake
#mopchk#image: mopchk
#mopd#image: mopd
#mopprobe#image: mopprobe
#moptrace#image: moptrace
MFLAGS=
osmake: force
@dir=$(MD)-$(OS); \
if [ ! -d $$dir ]; then ${MAKE} ${MFLAGS} config; fi; \
cd $$dir; ${MAKE} ${MFLAGS}
submake: force
-@for i in $(DIRS); do if [ ! -d $$i ]; then mkdir $$i; chmod ug+w $$i; \
sed -e "/^oslvl:/d" -e "s/^#$$i#//" Makefile >$$i/Makefile; \
chmod ug+w $$i/Makefile; cd $$i; \
${MAKE} ${MFLAGS} files; cd ..; fi; done; \
for i in $(DIRS); do cd $$i; ${MAKE} ${MFLAGS}; cd ..; done
osinstall: force
@os=$(OS); \
if [ -d $$os ]; then (cd $$os; ${MAKE} ${MFLAGS} INSTALL="$(INSTALL)" install); fi;
install: osinstall
@dir=$(MD)-$(OS); cd $$dir; \
for i in $(DIRS); do cd $$i; ${MAKE} ${MFLAGS} INSTALL="$(INSTALL)" inst; cd ..; done;
config:
@md=$(MD); os=$(OS); dir=$$md-$$os; \
mkdir $$dir; chmod ug+w $$dir; \
sed -e "/^toplvl:/d" -e "s/^#$$dir#//" Makefile >$$dir/Makefile; \
chmod ug+w $$dir/Makefile
tar:
@rel=$(REL); cd ..; \
tar -cf ../mopd-$$rel.tar [M]* c*/[Va-z]* m*/[MTa-np-z]* otherOS/*.[ch] otherOS/[M]* otherOS/*type otherOS/linux2/[Mm]*; \
gzip -9 ../mopd-$$rel.tar
#mopchk#files: force
#mopchk# echo "Adding files in mopchk"; \
#mopchk# ln -s ../../../common common; \
#mopchk# for i in $(CHFIL) $(CHHDR) $(CHDOC); do ln -s ../../../mopchk/$$i $$i; done; \
#mopchk# for i in $(COFIL); do ln -s ../../../common/$$i $$i; done; \
#mopchk# ln -s ../../$(OSHDR) os.h; ln -s ../../$(PFFIL) pf.c; \
#mopchk# ln -s ../../$(LOOP) loop.c
#mopchk#inst: mopchk
#mopchk# echo "Installing files in mopchk";
#mopchk# $(INSTBIN) $< $(INSTALL)/usr/sbin
#mopchk# $(INSTMAN) $(CHDOC) $(INSTALL)/usr/man/$(MANDIR)
#mopd#files: force
#mopd# echo "Adding files in mopd"; \
#mopd# ln -s ../../../common common; \
#mopd# for i in $(LDFIL) $(LDHDR) $(LDDOC); do ln -s ../../../mopd/$$i $$i; done; \
#mopd# for i in $(COFIL); do ln -s ../../../common/$$i $$i; done; \
#mopd# ln -s ../../$(OSHDR) os.h; ln -s ../../$(PFFIL) pf.c; \
#mopd# ln -s ../../$(LOOP) loop.c
#mopd#inst: mopd
#mopd# echo "Installing files in mopd";
#mopd# $(INSTBIN) $< $(INSTALL)/usr/sbin
#mopd# $(INSTMAN) $(LDDOC) $(INSTALL)/usr/man/$(MANDIR)
#mopprobe#files: force
#mopprobe# echo "Adding files in mopprobe"; \
#mopprobe# ln -s ../../../common common; \
#mopprobe# for i in $(PBFIL) $(PBHDR) $(PBDOC); do ln -s ../../../mopprobe/$$i $$i; done; \
#mopprobe# for i in $(COFIL); do ln -s ../../../common/$$i $$i; done; \
#mopprobe# ln -s ../../$(OSHDR) os.h; ln -s ../../$(PFFIL) pf.c; \
#mopprobe# ln -s ../../$(LOOP) loop.c
#mopprobe#inst: mopprobe
#mopprobe# echo "Installing files in mopprobe";
#mopprobe# $(INSTBIN) $< $(INSTALL)/usr/sbin
#mopprobe# $(INSTMAN) $(PBDOC) $(INSTALL)/usr/man/$(MANDIR)
#moptrace#files: force
#moptrace# echo "Adding files in moptrace"; \
#moptrace# ln -s ../../../common common; \
#moptrace# for i in $(TRFIL) $(TRHDR) $(TRDOC); do ln -s ../../../moptrace/$$i $$i; done; \
#moptrace# for i in $(COFIL); do ln -s ../../../common/$$i $$i; done; \
#moptrace# ln -s ../../$(OSHDR) os.h; ln -s ../../$(PFFIL) pf.c; \
#moptrace# ln -s ../../$(LOOP) loop.c
#moptrace#inst: moptrace
#moptrace# echo "Installing files in moptrace";
#moptrace# $(INSTBIN) $< $(INSTALL)/usr/sbin
#moptrace# $(INSTMAN) $(TRDOC) $(INSTALL)/usr/man/$(MANDIR)
mopchk: $(CHOBJ) $(COOBJ) $(OTOBJ) version.o
$(CC) $(CFLAGS) -o $@ $(CHOBJ) $(COOBJ) $(OTOBJ) version.o $(LIB)
mopd: $(LDOBJ) $(COOBJ) $(OTOBJ) version.o
$(CC) $(CFLAGS) -o $@ $(LDOBJ) $(COOBJ) $(OTOBJ) version.o $(LIB)
mopprobe: $(PBOBJ) $(COOBJ) $(OTOBJ) version.o
$(CC) $(CFLAGS) -o $@ $(PBOBJ) $(COOBJ) $(OTOBJ) version.o $(LIB)
moptrace: $(TROBJ) $(COOBJ) $(OTOBJ) version.o
$(CC) $(CFLAGS) -o $@ $(TROBJ) $(COOBJ) $(OTOBJ) version.o $(LIB)
VERSION:
@ln -s ../../../common/VERSION VERSION
version.o: version.c
version.c version.h: VERSION
rm -f version.c ; sed 's/.*/char version[] = "&";/' VERSION > version.c
set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' VERSION` ; \
{ echo '#define VERSION_MAJOR' $$1 ; \
echo '#define VERSION_MINOR' $$2 ; } > version.h
force: /tmp
|