-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile.in
398 lines (336 loc) · 12.9 KB
/
makefile.in
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#
#
#
# Name: makefile (make rules file)
# 'make' rules for the CMS FS driver and utility
# Source maintained as CMSFS MAKEFILE
# (aka "cmsfs.makefile") and processed by 'configure'.
#
#
#
#
# real-live CMS volume where these things are maintained
#XEDITSRC = /dev/dsk/01B5
#XEDITSRC = /dev/dasdf
XEDITSRC = dsk/cms1fs.dsk
#
# a mount-point to test the driver
#CMSMOUNT = /CMS/CMS1FS
CMSMOUNT = /tmp/cms1fs
#
# platform-specific definitions (substituted by 'configure')
DEFINES = %DEFINES%
INCLUDES = %INCLUDES%
PREFIX = %PREFIX%
BINDIR = %PREFIX%/bin
LIBDIR = %PREFIX%/lib
ETCDIR = %ETCDIR%
SBINDIR = %SBINDIR%
LINUX_RELEASE = %LINUX_RELEASE%
DRIVER_SOURCE = %DRIVER_SOURCE%
MODULES_DIRECTORY = %MODULES_DIRECTORY%
#
# list of target objects for the utility
OBJECTS = cmsfscat cmsfslst cmsfsvol cmsfsck cmsfscp
.PHONY: _default all clean distclean veryclean help \
module install rpm
#
# when the user does a "just make" easy build
_default: $(OBJECTS)
#
# all the usual products
all: $(OBJECTS) libcmsfs.a
#
############################################################### MAKEFILE
make: makefile
makefile: cmsfs.makefile cmsfscfg.sed makefile.in
@rm -f makefile-OLD makefile.old
@if [ -f makefile ] ; then mv makefile makefile-OLD ; fi
sed -f cmsfscfg.sed < cmsfs.makefile > makefile
@echo "$(MAKE): the makefile has been updated"
@echo " "
makefile.in: cmsfs.makefile
@rm -f makefile.in
cp -p cmsfs.makefile makefile.in
@touch makefile.in
cmsfscfg.sed: cmsfssed.sh
rm -f cmsfscfg.sed
@chmod +x cmsfssed.sh
sh -c ' exec ./cmsfssed.sh ' > cmsfscfg.sed
#cmsfsmak.sed: cmsfssed.sh
# rm -f cmsfsmak.sed
# @chmod +x cmsfssed.sh
# sh -c ' exec ./cmsfssed.sh ' > cmsfsmak.sed
#
################################################################# CONFIG
config: configure
@chmod +x configure
sh -c ' ./configure '
# @echo $(MAKE) makefile
# @echo @rm -f cmsfsvfs.c
# @echo $(MAKE) cmsfsvfs.c
configure: cmsfscfg.sh
@rm -f configure-OLD
@if [ -f configure ] ; then mv configure configure-OLD ; fi
cp cmsfscfg.sh configure
chmod +x configure
cmsfsvfs.c: $(DRIVER_SOURCE)
@rm -f cmsfsvfs.c
@if [ ! -z "$(DRIVER_SOURCE)" ] ; then \
echo " ln -s $(DRIVER_SOURCE) cmsfsvfs.c" ; \
ln -s $(DRIVER_SOURCE) cmsfsvfs.c ; fi
#
################################################################### DOCS
docs doc : README LICENSE INSTALL CREDITS cmsfsext.html
README: cmsfs.txt
@if [ -f README ] ; then mv README README-OLD ; fi
cp -p cmsfs.txt README
LICENSE: cmsfsgpl.txt
@if [ -f LICENSE ] ; then mv LICENSE LICENSE-OLD ; fi
cp -p cmsfsgpl.txt LICENSE
INSTALL: cmsfsmak.txt
@if [ -f INSTALL ] ; then mv INSTALL INSTALL-OLD ; fi
cp -p cmsfsmak.txt INSTALL
CREDITS: cmsfswho.txt
@if [ -f CREDITS ] ; then mv CREDITS CREDITS-OLD ; fi
cp -p cmsfswho.txt CREDITS
cmsfsext.html: makefile cmsfsext.h cmsfsext.htmlhead cmsfsext.htmltail
@rm -f cmsfsext.html
cat cmsfsext.htmlhead > cmsfsext.tmp
grep CMSFS cmsfsext.h | grep ',' | grep '"' \
| awk -F'{' '{print $$2}' \
| awk -F'}' '{print $$1}' \
| grep -v CMSFSANY | grep -v '*' \
| sed 's/CMSFSTXT/plain text/' \
| sed 's/CMSFSEXE/executable/' \
| sed 's/CMSFSBIN/binary/' \
| sed 's/CMSFSRAW/binary (with record lengths)/' \
| sed 's#"#<td><tt>#' | sed 's#"#</tt><td>#' \
| sed 's/,/ /g' | sed 's/|/,/g' \
| awk '{print "<tr>" $$0 "</tr>"}' >> cmsfsext.tmp
cat cmsfsext.htmltail >> cmsfsext.tmp
mv cmsfsext.tmp cmsfsext.html
########################################################################
#
# 'cmsfscat', write (concatenate) CMS files to stdout
cmsfscat: cmsfscat.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfscat cmsfscat.o -L. -lcmsfs
strip cmsfscat
cmsfscat.o: cmsfscat.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfscat.c
#
# 'cmsfslst', list CMS files in LISTFILE format
cmsfslst: cmsfslst.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfslst cmsfslst.o -L. -lcmsfs
strip cmsfslst
cmsfslst.o: cmsfslst.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfslst.c
#
# 'cmsfsvol', display CMS volume info in QUERY DISK format
cmsfsvol: cmsfsvol.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfsvol cmsfsvol.o -L. -lcmsfs
strip cmsfsvol
cmsfsvol.o: cmsfsvol.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfsvol.c
#
# 'cmsfsck', filesystem check for CMS volumes
cmsfsck: cmsfsck.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfsck cmsfsck.o -L. -lcmsfs
strip cmsfsck
cmsfsck.o: cmsfsck.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfsck.c
#
# 'cmsfscp', copy files from a CMS volume
cmsfscp: cmsfscp.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfscp cmsfscp.o -L. -lcmsfs
strip cmsfscp
cmsfscp.o: cmsfscp.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfscp.c
#
# 'cmsfsls', list CMS files in Unix 'ls' format
cmsfsls: cmsfsls.o libcmsfs.a
$(CC) $(DEFINES) -o cmsfsls cmsfsls.o -L. -lcmsfs
strip cmsfsls
cmsfsls.o: cmsfsls.c cmsfs.h aecs.h
$(CC) $(DEFINES) -c cmsfsls.c
#
#
libcmsfs.a: cmsfsusa.c cmsfsany.c cmsfs.h aecs.o aecs.h
$(CC) $(DEFINES) \
-c cmsfsusa.c -o cmsfsusa.o
ar q libcmsfs.a cmsfsusa.o aecs.o
#
# ASCII/EBCDIC translation table and functions
aecs.o: aecs.c aecs.h
$(CC) $(DEFINES) -c aecs.c
#
# driver module
cmsfs.o: makefile cmsfsvfs.c cmsfsany.c cmsfs.h aecs.c aecs.h
$(CC) $(DEFINES) -O2 -DMODULE $(INCLUDES) \
-c cmsfsvfs.c -o cmsfs.o
########################################################################
#
#
utility util: $(OBJECTS)
#
#
driver: /usr/src/linux/fs/cmsfs
#
#
module modules : cmsfs.o
#
#
test: cmsfsck cmsfscat cmsfslst cmsfscp cmsfsvol
./cmsfsck dsk/cms1fs.dsk
./cmsfscat -d dsk/cms1fs.dsk -a cmsfs.makefile >/dev/null
./cmsfslst -d dsk/cms1fs.dsk >/dev/null
./cmsfscp -d dsk/cms1fs.dsk -p -a cmsfs.makefile cms1fs.tmp
@rm cms1fs.tmp
./cmsfsvol dsk/cms1fs.dsk
@echo "$(MAKE): utility passed all tests"
########################################################################
/usr/src/linux/fs/cmsfs: cmsfsvfs.c cmsfsany.c cmsfsvfs.filelist \
cmsfs.h aecs.c aecs.h
mkdir /usr/src/linux/fs/cmsfs
@cat cmsfsvfs.filelist | grep -v '^*' \
| awk '{print tolower($$1) "." tolower($$2) " " \
$$4 " " tolower($$1) "." tolower($$2)}' \
| awk '{print "cp -p " $$1 \
" /usr/src/linux/fs/cmsfs/" $$2}' | sh -x
########################################################################
#
#
install: $(OBJECTS) libcmsfs.a
mkdir -p $(PREFIX)/bin
for F in $(OBJECTS) ; do \
rm -f $(PREFIX)/bin/$$F ; \
cp -p $$F $(PREFIX)/bin/. ; done
mkdir -p $(PREFIX)/lib
rm -f $(PREFIX)/lib/libcmsfs.a
cp -p libcmsfs.a $(PREFIX)/lib/.
#
mkdir -p $(PREFIX)/man/man8
cp -p *.8 $(PREFIX)/man/man8/.
#
mkdir -p $(SBINDIR)
rm -f $(SBINDIR)/fsck.cms
cp -p cmsfsck $(SBINDIR)/fsck.cms
#
mkdir -p $(ETCDIR)/init.d
cp -p cmsfsrun.init $(ETCDIR)/init.d/cmsfsrun
mkdir -p $(ETCDIR)/sysconfig
cp -p cmsfsrun.cfg $(ETCDIR)/sysconfig/cmsfsrun
mkdir -p $(PREFIX)/lib/systemd/system
cp -p cmsfsrun.service $(PREFIX)/lib/systemd/system/.
#
#
module_install modules_install : cmsfs.o cmsfsck
@test ! -z "$(MODULES_DIRECTORY)"
#/sbin/fsck.cms: $(PREFIX)/bin/cmsfsck
rm -f $(MODULES_DIRECTORY)/cmsfs.o
cp -p cmsfs.o $(MODULES_DIRECTORY)/.
rm -f /sbin/fsck.cms
cp -p cmsfsck /sbin/fsck.cms
#
#
rpm:
./cmsfsrpm.sh
########################################################################
#
# get the latest from the development minidisk
_refresh refresh: cmsfslst cmsfscp $(XEDITSRC)
@test -r $(XEDITSRC)
mkdir -p cmsfstmp
./cmsfslst -d $(XEDITSRC) | tail +4 \
| awk '{print $$1 "." $$2}' \
| grep -v ':' | grep -v '.-.' \
| tr A-Z a-z > cmsfstmp/.list
for F in `cat cmsfstmp/.list` ; do \
./cmsfscp -d $(XEDITSRC) \
-p -a $$F cmsfstmp/$$F ; \
done
rm cmsfstmp/.list
# sh -c ' new -d cmsfstmp/* . '
rm -r cmsfstmp
#
#
cmsfsedf.bin: cmsfsedf-$(HOSTTYPE).bin
cmsfsedf-CMS.bin:
@state CMSFS FILELIST *
@pipe command LISTFILE CMSFS FILELIST * \
| take first \
| spec w 3 1 \
| spec /Q DISK/ nw 1.1 nw \
| command \
| drop first \
| spec 7-* \
| spec /mdiskblk/ nw w 2 nw /1-/ nw w 10 n \
| spec 1-* 1 /! > cmsfsedf bin a f 4096/ nw \
| change x5A x4F \
| runpipe
cmsfsedf-i386.bin:
@echo "$(MAKE): you need to be on CMS to do this"
@sh -c ' exit 24 '
#
# exercise this stuff
_testrun testrun: $(OBJECTS) readcms.sh _testrun.sh
@if [ ! -d bin ] ; then mkdir bin ; fi
@if [ ! -d dsk ] ; then mkdir dsk ; fi
-dd if=$(XEDITSRC) of=dsk/TESTDISK
./cmsfsvol -d dsk/TESTDISK > /dev/null
@new -d cmsfsvol bin/.
./cmsfslst -d dsk/TESTDISK > /dev/null
@new -d cmsfslst bin/.
./cmsfscat -d dsk/TESTDISK -a cmsfs.filelist > /dev/null
@new -d cmsfscat bin/.
./cmsfsck dsk/TESTDISK
@new -d cmsfsck bin/.
./cmsfscp -d dsk/TESTDISK -a cmsfs.makefile testmake
@new -d cmsfscp bin/.
@chmod +x readcms.sh
@new -k readcms.sh bin/readcms
sh -c ' ./_testrun.sh $(OBJECTS) readcms'
#
#
mount: cmsfs.o
@mkdir -p -m 555$(CMSMOUNT)
insmod cmsfs.o
mount -t cms $(XEDITSRC) $(CMSMOUNT)
@echo " "
df $(CMSMOUNT)
@echo " "
########################################################################
#
# clean up your mess!
clean:
rm -f *.o *.a $(OBJECTS) *.tmp *-OLD \
a.out core *.exe CEEDUMP* \
driver module install
@rm -f testmake* newmake* testfile*
# @rm -f makefile* Makefile* ERR
#
#
distclean veryclean :
@$(MAKE) clean
# rm -f makefile* Makefile*
rm -f cmsfsvfs* *.sed
@touch "temp:file"
find . -type f -print | grep ':' | xargs rm
@touch "temp;file"
find . -type f -print | grep ';' | xargs rm
#
#
cmsagain: makefile
ls -d *.* | grep -v ';' | grep -v ':' \
| awk -F'.' '{print "cms openvm getbfs " $$0 \
" " $$1 " " $$2 " a \\( olddate replace"}' \
| sh -x
#
# good idea for 'make help' to be useful
help: makefile
@echo "$(MAKE):"
@echo "$(MAKE): some targets for this directory are:"
@echo "$(MAKE): all, module, install, clean"
@echo "$(MAKE):"
@echo "$(MAKE): configure with ./configure"
@echo "$(MAKE):"