1# Makefile for safecat
2
3default: it
4
5alloc.a: \
6makelib alloc.o alloc_re.o
7	./makelib alloc.a alloc.o alloc_re.o
8
9alloc.o: \
10compile alloc.c alloc.h error_no.h
11	./compile alloc.c
12
13alloc_re.o: \
14compile alloc_re.c alloc.h byte.h
15	./compile alloc_re.c
16
17auto-ccld.sh: \
18conf-cc conf-ld warn-auto.sh
19	( cat warn-auto.sh; \
20	echo CC=\'`head -1 conf-cc`\'; \
21	echo LD=\'`head -1 conf-ld`\'; \
22	) > auto-ccld.sh
23
24auto-str: \
25load auto-str.o substdio.a error.a str.a
26	./load auto-str substdio.a error.a str.a
27
28auto-str.o: \
29compile auto-str.c substdio.h readwrite.h exit.h
30	./compile auto-str.c
31
32auto_home.c: \
33auto-str conf-root
34	./auto-str auto_home `head -1 conf-root` > auto_home.c
35
36auto_home.o: \
37compile auto_home.c
38	./compile auto_home.c
39
40byte_chr.o: \
41compile byte_chr.c byte.h
42	./compile byte_chr.c
43
44byte_copy.o: \
45compile byte_copy.c byte.h
46	./compile byte_copy.c
47
48byte_cr.o: \
49compile byte_cr.c byte.h
50	./compile byte_cr.c
51
52byte_diff.o: \
53compile byte_diff.c byte.h
54	./compile byte_diff.c
55
56byte_zero.o: \
57compile byte_zero.c byte.h
58	./compile byte_zero.c
59
60check: \
61it instcheck
62	./instcheck
63
64clean: \
65TARGETS
66	rm -f `cat TARGETS`
67
68compile: \
69make-compile warn-auto.sh systype conf-includes
70	( cat warn-auto.sh; ./make-compile "`cat systype`" ) > \
71	compile
72	chmod 755 compile
73
74envread.o: \
75compile envread.c env.h str.h
76	./compile envread.c
77
78error.a: \
79makelib error.o error_str.o
80	./makelib error.a error.o error_str.o
81
82error_no.h: \
83tryerrno.c compile load error_no.h1 error_no.h2
84	( ( ./compile tryerrno.c && ./load tryerrno && \
85	./tryerrno ) >/dev/null 2>&1 \
86	&& cat error_no.h1 || cat error_no.h2 ) > error_no.h
87	rm -f tryerrno.o tryerrno
88
89error.o: \
90compile error.c error_no.h
91	./compile error.c
92
93error_str.o: \
94compile error_str.c error_no.h
95	./compile error_str.c
96
97fmt_uint64.o: \
98compile fmt_uint64.c fmt.h uint64.h
99	./compile fmt_uint64.c
100
101hier.o: \
102compile hier.c auto_home.h
103	./compile hier.c
104
105install: \
106load install.o hier.o auto_home.o strerr.a substdio.a open.a error.a \
107str.a
108	./load install hier.o auto_home.o strerr.a substdio.a \
109	open.a error.a str.a
110
111install.o: \
112compile install.c substdio.h strerr.h error_no.h open.h readwrite.h \
113exit.h buffer.h
114	./compile install.c
115
116instcheck: \
117load instcheck.o hier.o auto_home.o strerr.a substdio.a error.a str.a
118	./load instcheck hier.o auto_home.o strerr.a substdio.a \
119	error.a str.a
120
121instcheck.o: \
122compile instcheck.c strerr.h error_no.h readwrite.h exit.h
123	./compile instcheck.c
124
125it: \
126maildir safecat man
127
128find-systype: \
129find-systype.sh auto-ccld.sh
130	cat auto-ccld.sh find-systype.sh > find-systype
131	chmod 755 find-systype
132
133getln.a: \
134makelib getln.o getln2.o
135	./makelib getln.a getln.o getln2.o
136
137getln.o: \
138compile getln.c substdio.h byte.h stralloc.h gen_alloc.h getln.h
139	./compile getln.c
140
141getln2.o: \
142compile getln2.c substdio.h stralloc.h gen_alloc.h byte.h getln.h
143	./compile getln2.c
144
145hassgact.h: \
146trysgact.c compile load
147	( ( ./compile trysgact.c && ./load trysgact ) >/dev/null \
148	2>&1 \
149	&& echo \#define HASSIGACTION 1 || exit 0 ) > hassgact.h
150	rm -f trysgact.o trysgact
151
152hostname.o: \
153compile hostname.c
154	./compile hostname.c
155
156load: \
157make-load warn-auto.sh systype
158	( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
159	chmod 755 load
160
161maildir: \
162warn-auto.sh maildir.sh conf-root
163	cat warn-auto.sh maildir.sh \
164	| sed s}HOME}"`head -1 conf-root`"}g \
165	> maildir
166	chmod 755 maildir
167
168maildir.0: \
169maildir.1
170	nroff -man maildir.1 > maildir.0
171
172make-compile: \
173make-compile.sh auto-ccld.sh
174	cat auto-ccld.sh make-compile.sh > make-compile
175	chmod 755 make-compile
176
177make-load: \
178make-load.sh auto-ccld.sh
179	cat auto-ccld.sh make-load.sh > make-load
180	chmod 755 make-load
181
182makelib: \
183warn-auto.sh systype
184	( cat warn-auto.sh; \
185	echo 'main="$$1"; shift'; \
186	echo 'rm -f "$$main"'; \
187	echo 'ar cr "$$main" $${1+"$$@"}'; \
188	case "`cat systype`" in \
189	sunos-5.*) ;; \
190	unix_sv*) ;; \
191	irix64-*) ;; \
192	irix-*) ;; \
193	dgux-*) ;; \
194	hp-ux-*) ;; \
195	sco*) ;; \
196	*) echo 'ranlib "$$main"' ;; \
197	esac \
198	) > makelib
199	chmod 755 makelib
200
201man: \
202safecat.0 maildir.0
203
204open.a: \
205makelib open_read.o open_trunc.o open_append.o
206	./makelib open.a open_read.o open_trunc.o open_append.o
207
208open_append.o: \
209compile open_append.c open.h
210	./compile open_append.c
211
212open_read.o: \
213compile open_read.c open.h
214	./compile open_read.c
215
216open_trunc.o: \
217compile open_trunc.c open.h
218	./compile open_trunc.c
219
220safecat: \
221load safecat.o getln.a str.a stralloc.a strerr.a substdio.a alloc.o \
222alloc_re.o byte_cr.o envread.o error.o error_str.o fmt_uint64.o \
223hostname.o sig.o stat_dir.o str_diffn.o substdio_copy.o \
224substdi.o substdio.o taia_fmtfrac.o taia_now.o taia_tai.o tempfile.o \
225writefile.o
226	./load safecat getln.a stralloc.a strerr.a substdio.a str.a \
227	alloc.o alloc_re.o byte_cr.o envread.o error.o \
228	error_str.o fmt_uint64.o hostname.o sig.o stat_dir.o str_diffn.o \
229	substdi.o substdio.o substdio_copy.o taia_fmtfrac.o \
230	taia_now.o taia_tai.o tempfile.o writefile.o
231
232safecat.0: \
233safecat.1
234	nroff -man safecat.1 > safecat.0
235
236safecat.o: \
237compile safecat.c uint32.h version.h sig.h tempfile.h stat_dir.h \
238writefile.h
239	./compile safecat.c
240
241sig.o: \
242compile sig.c hassgact.h
243	./compile sig.c
244
245setup: \
246it install
247	./install
248
249stat_dir.o: \
250compile stat_dir.c
251	./compile stat_dir.c
252
253str.a: \
254makelib str_len.o byte_chr.o byte_diff.o byte_copy.o byte_cr.o \
255byte_zero.o
256	./makelib str.a str_len.o byte_chr.o byte_diff.o \
257	byte_copy.o byte_cr.o byte_zero.o
258
259str_diffn.o: \
260compile str_diffn.c str.h
261	./compile str_diffn.c
262
263str_len.o: \
264compile str_len.c str.h
265	./compile str_len.c
266
267stralloc.a: \
268makelib stralloc_eady.o stralloc_pend.o stralloc_copy.o \
269stralloc_opys.o stralloc_opyb.o stralloc_cat.o stralloc_cats.o \
270stralloc_catb.o stralloc_arts.o stralloc_num.o
271	./makelib stralloc.a stralloc_eady.o stralloc_pend.o \
272	stralloc_copy.o stralloc_opys.o stralloc_opyb.o \
273	stralloc_cat.o stralloc_cats.o stralloc_catb.o \
274	stralloc_arts.o stralloc_num.o
275
276stralloc_arts.o: \
277compile stralloc_arts.c byte.h str.h stralloc.h gen_alloc.h
278	./compile stralloc_arts.c
279
280stralloc_cat.o: \
281compile stralloc_cat.c byte.h stralloc.h gen_alloc.h
282	./compile stralloc_cat.c
283
284stralloc_catb.o: \
285compile stralloc_catb.c stralloc.h gen_alloc.h byte.h
286	./compile stralloc_catb.c
287
288stralloc_cats.o: \
289compile stralloc_cats.c byte.h str.h stralloc.h gen_alloc.h
290	./compile stralloc_cats.c
291
292stralloc_copy.o: \
293compile stralloc_copy.c byte.h stralloc.h gen_alloc.h
294	./compile stralloc_copy.c
295
296stralloc_eady.o: \
297compile stralloc_eady.c alloc.h stralloc.h gen_alloc.h \
298gen_allocdefs.h
299	./compile stralloc_eady.c
300
301stralloc_num.o: \
302compile stralloc_num.c stralloc.h gen_alloc.h
303	./compile stralloc_num.c
304
305stralloc_opyb.o: \
306compile stralloc_opyb.c stralloc.h gen_alloc.h byte.h
307	./compile stralloc_opyb.c
308
309stralloc_opys.o: \
310compile stralloc_opys.c byte.h str.h stralloc.h gen_alloc.h
311	./compile stralloc_opys.c
312
313stralloc_pend.o: \
314compile stralloc_pend.c alloc.h stralloc.h gen_alloc.h \
315gen_allocdefs.h
316	./compile stralloc_pend.c
317
318strerr.a: \
319makelib strerr_sys.o strerr_die.o
320	./makelib strerr.a strerr_sys.o strerr_die.o
321
322strerr_die.o: \
323compile strerr_die.c substdio.h subfd.h substdio.h exit.h strerr.h
324	./compile strerr_die.c
325
326strerr_sys.o: \
327compile strerr_sys.c error_no.h strerr.h
328	./compile strerr_sys.c
329
330subfderr.o: \
331compile subfderr.c readwrite.h substdio.h subfd.h substdio.h
332	./compile subfderr.c
333
334subfdin.o: \
335compile subfdin.c readwrite.h substdio.h subfd.h substdio.h
336	./compile subfdin.c
337
338subfdins.o: \
339compile subfdins.c readwrite.h substdio.h subfd.h substdio.h
340	./compile subfdins.c
341
342subfdout.o: \
343compile subfdout.c readwrite.h substdio.h subfd.h substdio.h
344	./compile subfdout.c
345
346subfdouts.o: \
347compile subfdouts.c readwrite.h substdio.h subfd.h substdio.h
348	./compile subfdouts.c
349
350substdi.o: \
351compile substdi.c substdio.h byte.h error_no.h
352	./compile substdi.c
353
354substdio.a: \
355makelib substdio.o substdi.o substdo.o subfderr.o subfdout.o \
356subfdouts.o subfdin.o subfdins.o substdio_copy.o
357	./makelib substdio.a substdio.o substdi.o substdo.o \
358	subfderr.o subfdout.o subfdouts.o subfdin.o subfdins.o \
359	substdio_copy.o
360
361substdio.o: \
362compile substdio.c substdio.h
363	./compile substdio.c
364
365substdio_copy.o: \
366compile substdio_copy.c substdio.h
367	./compile substdio_copy.c
368
369substdo.o: \
370compile substdo.c substdio.h str.h byte.h error_no.h
371	./compile substdo.c
372
373systype: \
374find-systype trycpp.c
375	./find-systype > systype
376
377taia_fmtfrac.o: \
378compile taia_fmtfrac.c taia.h tai.h uint64.h
379	./compile taia_fmtfrac.c
380
381taia_now.o: \
382compile taia_now.c taia.h tai.h uint64.h
383	./compile taia_now.c
384
385taia_tai.o: \
386compile taia_tai.c taia.h tai.h uint64.h
387	./compile taia_tai.c
388
389tempfile.o: \
390compile tempfile.c
391	./compile tempfile.c
392
393uint32.h: \
394tryulong32.c compile load uint32.h1 uint32.h2
395	( ( ./compile tryulong32.c && ./load tryulong32 && \
396	./tryulong32 ) >/dev/null 2>&1 \
397	&& cat uint32.h2 || cat uint32.h1 ) > uint32.h
398	rm -f tryulong32.o tryulong32
399
400uint64.h: \
401tryulong64.c compile load uint64.h1 uint64.h2
402	( ( ./compile tryulong64.c && ./load tryulong64 && \
403	./tryulong64 ) >/dev/null 2>&1 \
404	&& cat uint64.h2 || cat uint64.h1 ) > uint64.h
405	rm -f tryulong64.o tryulong64
406
407version.h: \
408conf-version
409	@echo 'static const char *const version_string="$$Version:' \
410	`head -1 conf-version` 'built' `date +"%b %d, %Y"` at \
411	`date +"%H:%M"`'$$";' > version.h
412
413writefile.o: \
414compile writefile.c
415	./compile writefile.c
416