summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 27d97011a1cc13a8ef0ae404923991a3a6dc0b81 (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
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
# Don't edit Makefile! Use conf-* for configuration.

SHELL=/bin/sh

default: it

alloc.a: \
makelib alloc.o
	./makelib alloc.a alloc.o

alloc.o: \
compile alloc.c alloc.h error.h
	./compile alloc.c

auto-str: \
load auto-str.o buffer.a unix.a byte.a
	./load auto-str buffer.a unix.a byte.a 

auto-str.o: \
compile auto-str.c buffer.h readwrite.h exit.h
	./compile auto-str.c

auto_home.c: \
auto-str conf-home
	./auto-str auto_home `head -1 conf-home` > auto_home.c

auto_home.o: \
compile auto_home.c
	./compile auto_home.c

buffer.a: \
makelib strerr_sys.o buffer.o buffer_put.o buffer_2.o strerr_die.o \
buffer_get.o buffer_copy.o buffer_1.o buffer_0.o buffer_1s.o
	./makelib buffer.a strerr_sys.o buffer.o buffer_put.o \
	buffer_2.o strerr_die.o buffer_get.o buffer_copy.o \
	buffer_1.o buffer_0.o buffer_1s.o

buffer.o: \
compile buffer.c buffer.h
	./compile buffer.c

buffer_0.o: \
compile buffer_0.c readwrite.h buffer.h
	./compile buffer_0.c

buffer_1.o: \
compile buffer_1.c readwrite.h buffer.h
	./compile buffer_1.c

buffer_1s.o: \
compile buffer_1s.c readwrite.h buffer.h
	./compile buffer_1s.c

buffer_2.o: \
compile buffer_2.c readwrite.h buffer.h
	./compile buffer_2.c

buffer_copy.o: \
compile buffer_copy.c buffer.h
	./compile buffer_copy.c

buffer_get.o: \
compile buffer_get.c buffer.h byte.h error.h
	./compile buffer_get.c

buffer_put.o: \
compile buffer_put.c buffer.h str.h byte.h error.h
	./compile buffer_put.c

byte.a: \
makelib byte_copy.o byte_cr.o str_len.o fmt_ulong.o uint32_unpack.o \
byte_diff.o uint32_pack.o scan_ulong.o
	./makelib byte.a byte_copy.o byte_cr.o str_len.o \
	fmt_ulong.o uint32_unpack.o byte_diff.o uint32_pack.o \
	scan_ulong.o

byte_copy.o: \
compile byte_copy.c byte.h
	./compile byte_copy.c

byte_cr.o: \
compile byte_cr.c byte.h
	./compile byte_cr.c

byte_diff.o: \
compile byte_diff.c byte.h
	./compile byte_diff.c

cdb.a: \
makelib cdb.o cdb_hash.o cdb_make.o
	./makelib cdb.a cdb.o cdb_hash.o cdb_make.o

cdb.o: \
compile cdb.c readwrite.h error.h seek.h byte.h cdb.h uint32.h
	./compile cdb.c

cdb_hash.o: \
compile cdb_hash.c cdb.h uint32.h
	./compile cdb_hash.c

cdb_make.o: \
compile cdb_make.c readwrite.h seek.h error.h alloc.h cdb.h uint32.h \
cdb_make.h buffer.h uint32.h
	./compile cdb_make.c

cdbdump: \
load cdbdump.o buffer.a unix.a byte.a
	./load cdbdump buffer.a unix.a byte.a 

cdbdump.o: \
compile cdbdump.c uint32.h fmt.h buffer.h strerr.h
	./compile cdbdump.c

cdbget: \
load cdbget.o cdb.a buffer.a unix.a byte.a
	./load cdbget cdb.a buffer.a unix.a byte.a 

cdbget.o: \
compile cdbget.c exit.h scan.h str.h buffer.h strerr.h cdb.h uint32.h
	./compile cdbget.c

cdbmake: \
load cdbmake.o cdb.a alloc.a buffer.a unix.a byte.a
	./load cdbmake cdb.a alloc.a buffer.a unix.a byte.a 

cdbmake-12: \
warn-auto.sh cdbmake-12.sh conf-home
	cat warn-auto.sh cdbmake-12.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	> cdbmake-12
	chmod 755 cdbmake-12

cdbmake-sv: \
warn-auto.sh cdbmake-sv.sh conf-home
	cat warn-auto.sh cdbmake-sv.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	> cdbmake-sv
	chmod 755 cdbmake-sv

cdbmake.o: \
compile cdbmake.c error.h open.h strerr.h cdb_make.h buffer.h \
uint32.h cdb.h uint32.h
	./compile cdbmake.c

cdbstats: \
load cdbstats.o cdb.a buffer.a unix.a byte.a
	./load cdbstats cdb.a buffer.a unix.a byte.a 

cdbstats.o: \
compile cdbstats.c uint32.h fmt.h buffer.h strerr.h seek.h cdb.h \
uint32.h
	./compile cdbstats.c

cdbtest: \
load cdbtest.o cdb.a buffer.a unix.a byte.a
	./load cdbtest cdb.a buffer.a unix.a byte.a 

cdbtest.o: \
compile cdbtest.c uint32.h fmt.h buffer.h strerr.h seek.h cdb.h \
uint32.h
	./compile cdbtest.c

check: \
it instcheck
	./instcheck

compile: \
warn-auto.sh conf-cc
	( cat warn-auto.sh; \
	echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \
	) > compile
	chmod 755 compile

error.o: \
compile error.c error.h
	./compile error.c

error_str.o: \
compile error_str.c error.h
	./compile error_str.c

fmt_ulong.o: \
compile fmt_ulong.c fmt.h
	./compile fmt_ulong.c

hier.o: \
compile hier.c auto_home.h
	./compile hier.c

install: \
load install.o hier.o auto_home.o buffer.a unix.a byte.a
	./load install hier.o auto_home.o buffer.a unix.a byte.a 

install.o: \
compile install.c buffer.h strerr.h error.h open.h readwrite.h exit.h
	./compile install.c

instcheck: \
load instcheck.o hier.o auto_home.o buffer.a unix.a byte.a
	./load instcheck hier.o auto_home.o buffer.a unix.a byte.a 

instcheck.o: \
compile instcheck.c strerr.h error.h readwrite.h exit.h
	./compile instcheck.c

it: \
prog install instcheck

load: \
warn-auto.sh conf-ld
	( cat warn-auto.sh; \
	echo 'main="$$1"; shift'; \
	echo exec "`head -1 conf-ld`" \
	'-o "$$main" "$$main".o $${1+"$$@"}' \
	) > load
	chmod 755 load

makelib: \
warn-auto.sh systype
	( cat warn-auto.sh; \
	echo 'main="$$1"; shift'; \
	echo 'rm -f "$$main"'; \
	echo 'ar cr "$$main" $${1+"$$@"}'; \
	case "`cat systype`" in \
	sunos-5.*) ;; \
	unix_sv*) ;; \
	irix64-*) ;; \
	irix-*) ;; \
	dgux-*) ;; \
	hp-ux-*) ;; \
	sco*) ;; \
	*) echo 'ranlib "$$main"' ;; \
	esac \
	) > makelib
	chmod 755 makelib

open_read.o: \
compile open_read.c open.h
	./compile open_read.c

open_trunc.o: \
compile open_trunc.c open.h
	./compile open_trunc.c

prog: \
cdbget cdbmake cdbdump cdbstats cdbtest cdbmake-12 cdbmake-sv rts \
testzero

rts: \
warn-auto.sh rts.sh conf-home
	cat warn-auto.sh rts.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	> rts
	chmod 755 rts

scan_ulong.o: \
compile scan_ulong.c scan.h
	./compile scan_ulong.c

seek_cur.o: \
compile seek_cur.c seek.h
	./compile seek_cur.c

seek_set.o: \
compile seek_set.c seek.h
	./compile seek_set.c

setup: \
it install
	./install

str_len.o: \
compile str_len.c str.h
	./compile str_len.c

strerr_die.o: \
compile strerr_die.c buffer.h exit.h strerr.h
	./compile strerr_die.c

strerr_sys.o: \
compile strerr_sys.c error.h strerr.h
	./compile strerr_sys.c

systype: \
find-systype.sh conf-cc conf-ld trycpp.c x86cpuid.c
	( cat warn-auto.sh; \
	echo CC=\'`head -1 conf-cc`\'; \
	echo LD=\'`head -1 conf-ld`\'; \
	cat find-systype.sh; \
	) | sh > systype

testzero: \
load testzero.o cdb.a alloc.a buffer.a unix.a byte.a
	./load testzero cdb.a alloc.a buffer.a unix.a byte.a 

testzero.o: \
compile testzero.c uint32.h scan.h strerr.h cdb_make.h buffer.h \
uint32.h
	./compile testzero.c

uint32.h: \
tryulong32.c compile load uint32.h1 uint32.h2
	( ( ./compile tryulong32.c && ./load tryulong32 && \
	./tryulong32 ) >/dev/null 2>&1 \
	&& cat uint32.h2 || cat uint32.h1 ) > uint32.h
	rm -f tryulong32.o tryulong32

uint32_pack.o: \
compile uint32_pack.c uint32.h
	./compile uint32_pack.c

uint32_unpack.o: \
compile uint32_unpack.c uint32.h
	./compile uint32_unpack.c

unix.a: \
makelib error.o open_read.o open_trunc.o error_str.o seek_set.o \
seek_cur.o
	./makelib unix.a error.o open_read.o open_trunc.o \
	error_str.o seek_set.o seek_cur.o