1IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
2
3default: sysdeps $(IT)
4
5check: $(IT)
6	./check-local $(IT)
7
8runit: load runit.o unix.a byte.a
9	./load runit unix.a byte.a -static
10
11runit-init: load runit-init.o unix.a byte.a
12	./load runit-init unix.a byte.a -static
13
14runsv: load runsv.o unix.a byte.a time.a
15	./load runsv unix.a byte.a time.a
16
17runsvdir: load runsvdir.o unix.a byte.a time.a
18	./load runsvdir unix.a byte.a time.a
19
20runsvstat: load runsvstat.o unix.a byte.a time.a
21	./load runsvstat unix.a byte.a time.a
22
23runsvctrl: load runsvctrl.o unix.a byte.a
24	./load runsvctrl unix.a byte.a
25
26sv: load sv.o unix.a byte.a time.a
27	./load sv unix.a byte.a time.a
28
29svwaitup: load svwaitup.o unix.a byte.a time.a
30	./load svwaitup unix.a byte.a time.a
31
32svwaitdown: load svwaitdown.o unix.a byte.a time.a
33	./load svwaitdown unix.a byte.a time.a
34
35utmpset: load utmpset.o unix.a byte.a
36	./load utmpset unix.a byte.a
37
38runsvchdir: load runsvchdir.o unix.a byte.a
39	./load runsvchdir unix.a byte.a
40
41svlogd: load svlogd.o pmatch.o fmt_ptime.o unix.a byte.a time.a socket.lib
42	./load svlogd pmatch.o fmt_ptime.o unix.a byte.a time.a \
43	`cat socket.lib`
44
45chpst: load chpst.o uidgid.o unix.a byte.a
46	./load chpst uidgid.o unix.a byte.a
47
48runit.o: compile sysdeps runit.c
49	./compile runit.c
50
51runit-init.o: compile runit-init.c
52	./compile runit-init.c
53
54runsv.o: compile sysdeps runsv.c
55	./compile runsv.c
56
57runsvdir.o: compile sysdeps runsvdir.c
58	./compile runsvdir.c
59
60runsvstat.o: compile sysdeps runsvstat.c
61	./compile runsvstat.c
62
63runsvctrl.o: compile runsvctrl.c
64	./compile runsvctrl.c
65
66sv.o: compile sysdeps sv.c
67	./compile sv.c
68
69svwaitup.o: compile sysdeps svwaitup.c
70	./compile svwaitup.c
71
72svwaitdown.o: compile sysdeps svwaitdown.c
73	./compile svwaitdown.c
74
75utmpset.o: compile sysdeps utmpset.c
76	./compile utmpset.c
77
78runsvchdir.o: compile runsvchdir.c
79	./compile runsvchdir.c
80
81svlogd.o: compile sysdeps svlogd.c
82	./compile svlogd.c
83
84chpst.o: compile sysdeps chpst.c
85	./compile chpst.c
86
87
88uidgid.o: compile uidgid.c uidgid.h
89	./compile uidgid.c
90
91pmatch.o: compile pmatch.c
92	./compile pmatch.c
93
94fmt_ptime.o: compile sysdeps fmt_ptime.c
95	./compile fmt_ptime.c
96
97reboot_system.h: choose compile reboot_system.h1 reboot_system.h2
98	./choose c tryreboot reboot_system.h1 reboot_system.h2 > \
99	  reboot_system.h
100
101uw_tmp.h: compile uw_tmp.h1 uw_tmp.h2
102	( ./compile tryuwtmpx.c 2>/dev/null && cat uw_tmp.h2 >uw_tmp.h ) || \
103	( ./compile tryuwtmp.c 2>/dev/null && cat uw_tmp.h1 >uw_tmp.h )
104	rm -f tryuwtmp.o tryuwtmpx.o
105
106socket.lib: compile load trysocketlib.c
107	./compile trysocketlib.c
108	( ./load trysocketlib >/dev/null 2>&1 || \
109	  ( ./load trysocketlib -lxnet >/dev/null 2>&1 && echo '-lxnet' ) || \
110	  ( ./load trysocketlib -lsocket -lnsl >/dev/null 2>&1 && \
111	    echo '-lsocket -lnsl' ) \
112	) >socket.lib
113	rm -f trysocketlib.o trysocketlib
114
115clean:
116	find . -name \*~ -exec rm -f {} \;
117	find . -name .??*~ -exec rm -f {} \;
118	find . -name \#?* -exec rm -f {} \;
119	rm -f `cat TARGETS`
120
121alloc.o: alloc.c alloc.h compile error.h
122	./compile alloc.c
123
124alloc_re.o: alloc.h alloc_re.c byte.h compile
125	./compile alloc_re.c
126
127buffer.o: buffer.c buffer.h compile
128	./compile buffer.c
129
130buffer_0.o: buffer.h buffer_0.c compile
131	./compile buffer_0.c
132
133buffer_1.o: buffer.h buffer_1.c compile
134	./compile buffer_1.c
135
136buffer_2.o: buffer.h buffer_2.c compile
137	./compile buffer_2.c
138
139buffer_get.o: buffer.h buffer_get.c byte.h compile error.h
140	./compile buffer_get.c
141
142buffer_put.o: buffer.h buffer_put.c byte.h compile error.h str.h
143	./compile buffer_put.c
144
145buffer_read.o: buffer.h buffer_read.c compile
146	./compile buffer_read.c
147
148buffer_write.o: buffer.h buffer_write.c compile
149	./compile buffer_write.c
150
151byte.a: byte_chr.o byte_copy.o byte_cr.o byte_diff.o byte_rchr.o \
152fmt_uint.o fmt_uint0.o fmt_ulong.o makelib scan_ulong.o str_chr.o \
153str_diff.o str_len.o str_start.o
154	./makelib byte.a byte_chr.o byte_copy.o byte_cr.o byte_diff.o \
155	byte_rchr.o fmt_uint.o fmt_uint0.o fmt_ulong.o scan_ulong.o str_chr.o \
156	str_diff.o str_len.o str_start.o
157
158byte_chr.o: byte.h byte_chr.c compile
159	./compile byte_chr.c
160
161byte_copy.o: byte.h byte_copy.c compile
162	./compile byte_copy.c
163
164byte_cr.o: byte.h byte_cr.c compile
165	./compile byte_cr.c
166
167byte_diff.o: byte.h byte_diff.c compile
168	./compile byte_diff.c
169
170byte_rchr.o: byte.h byte_rchr.c compile
171	./compile byte_rchr.c
172
173chkshsgr: chkshsgr.o load
174	./load chkshsgr
175
176chkshsgr.o: chkshsgr.c compile
177	./compile chkshsgr.c
178
179choose: choose.sh warn-auto.sh
180	rm -f choose
181	cat warn-auto.sh choose.sh \
182	> choose
183	chmod 555 choose
184
185coe.o: coe.c coe.h compile
186	./compile coe.c
187
188compile: conf-cc print-cc.sh systype warn-auto.sh
189	rm -f compile
190	sh print-cc.sh > compile
191	chmod 555 compile
192
193direntry.h: choose compile direntry.h1 direntry.h2 trydrent.c
194	./choose c trydrent direntry.h1 direntry.h2 > direntry.h
195
196env.o: compile env.c env.h str.h
197	./compile env.c
198
199error.o: compile error.c error.h
200	./compile error.c
201
202error_str.o: compile error.h error_str.c
203	./compile error_str.c
204
205fd_copy.o: compile fd.h fd_copy.c
206	./compile fd_copy.c
207
208fd_move.o: compile fd.h fd_move.c
209	./compile fd_move.c
210
211fifo.o: compile fifo.c fifo.h hasmkffo.h
212	./compile fifo.c
213
214fmt_uint.o: compile fmt.h fmt_uint.c
215	./compile fmt_uint.c
216
217fmt_uint0.o: compile fmt.h fmt_uint0.c
218	./compile fmt_uint0.c
219
220fmt_ulong.o: compile fmt.h fmt_ulong.c
221	./compile fmt_ulong.c
222
223hasflock.h: choose compile hasflock.h1 hasflock.h2 load tryflock.c
224	./choose cl tryflock hasflock.h1 hasflock.h2 > hasflock.h
225
226hasmkffo.h: choose compile hasmkffo.h1 hasmkffo.h2 load trymkffo.c
227	./choose cl trymkffo hasmkffo.h1 hasmkffo.h2 > hasmkffo.h
228
229hassgact.h: choose compile hassgact.h1 hassgact.h2 load trysgact.c
230	./choose cl trysgact hassgact.h1 hassgact.h2 > hassgact.h
231
232hassgprm.h: choose compile hassgprm.h1 hassgprm.h2 load trysgprm.c
233	./choose cl trysgprm hassgprm.h1 hassgprm.h2 > hassgprm.h
234
235hasshsgr.h: chkshsgr choose compile hasshsgr.h1 hasshsgr.h2 load \
236tryshsgr.c warn-shsgr
237	./chkshsgr || ( cat warn-shsgr; exit 1 )
238	./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h
239
240haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c
241	./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h
242
243iopause.h: choose compile iopause.h1 iopause.h2 load trypoll.c
244	./choose clr trypoll iopause.h1 iopause.h2 > iopause.h
245
246iopause.o: compile iopause.c iopause.h select.h tai.h taia.h uint64.h
247	./compile iopause.c
248
249load: conf-ld print-ld.sh systype warn-auto.sh
250	rm -f load
251	sh print-ld.sh > load
252	chmod 555 load
253
254lock_ex.o: compile hasflock.h lock.h lock_ex.c
255	./compile lock_ex.c
256
257lock_exnb.o: compile hasflock.h lock.h lock_exnb.c
258	./compile lock_exnb.c
259
260makelib: print-ar.sh systype warn-auto.sh
261	rm -f makelib
262	sh print-ar.sh > makelib
263	chmod 555 makelib
264
265ndelay_off.o: compile ndelay.h ndelay_off.c
266	./compile ndelay_off.c
267
268ndelay_on.o: compile ndelay.h ndelay_on.c
269	./compile ndelay_on.c
270
271open_append.o: compile open.h open_append.c
272	./compile open_append.c
273
274open_read.o: compile open.h open_read.c
275	./compile open_read.c
276
277open_trunc.o: compile open.h open_trunc.c
278	./compile open_trunc.c
279
280open_write.o: compile open.h open_write.c
281	./compile open_write.c
282
283openreadclose.o: compile error.h gen_alloc.h open.h openreadclose.c \
284openreadclose.h readclose.h stralloc.h
285	./compile openreadclose.c
286
287pathexec_env.o: alloc.h byte.h compile env.h gen_alloc.h pathexec.h \
288pathexec_env.c str.h stralloc.h
289	./compile pathexec_env.c
290
291pathexec_run.o: compile env.h error.h gen_alloc.h pathexec.h \
292pathexec_run.c str.h stralloc.h
293	./compile pathexec_run.c
294
295prot.o: compile hasshsgr.h prot.c prot.h
296	./compile prot.c
297
298readclose.o: compile error.h gen_alloc.h readclose.c readclose.h \
299stralloc.h
300	./compile readclose.c
301
302scan_ulong.o: compile scan.h scan_ulong.c
303	./compile scan_ulong.c
304
305seek_set.o: compile seek.h seek_set.c
306	./compile seek_set.c
307
308select.h: choose compile select.h1 select.h2 trysysel.c
309	./choose c trysysel select.h1 select.h2 > select.h
310
311sgetopt.o: buffer.h compile sgetopt.c sgetopt.h subgetopt.h
312	./compile sgetopt.c
313
314sig.o: compile sig.c sig.h
315	./compile sig.c
316
317sig_block.o: compile hassgprm.h sig.h sig_block.c
318	./compile sig_block.c
319
320sig_catch.o: compile hassgact.h sig.h sig_catch.c
321	./compile sig_catch.c
322
323sig_pause.o: compile hassgprm.h sig.h sig_pause.c
324	./compile sig_pause.c
325
326str_chr.o: compile str.h str_chr.c
327	./compile str_chr.c
328
329str_diff.o: compile str.h str_diff.c
330	./compile str_diff.c
331
332str_len.o: compile str.h str_len.c
333	./compile str_len.c
334
335str_start.o: compile str.h str_start.c
336	./compile str_start.c
337
338stralloc_cat.o: byte.h compile gen_alloc.h stralloc.h stralloc_cat.c
339	./compile stralloc_cat.c
340
341stralloc_catb.o: byte.h compile gen_alloc.h stralloc.h \
342stralloc_catb.c
343	./compile stralloc_catb.c
344
345stralloc_cats.o: byte.h compile gen_alloc.h str.h stralloc.h \
346stralloc_cats.c
347	./compile stralloc_cats.c
348
349stralloc_eady.o: alloc.h compile gen_alloc.h gen_allocdefs.h \
350stralloc.h stralloc_eady.c
351	./compile stralloc_eady.c
352
353stralloc_opyb.o: byte.h compile gen_alloc.h stralloc.h \
354stralloc_opyb.c
355	./compile stralloc_opyb.c
356
357stralloc_opys.o: byte.h compile gen_alloc.h str.h stralloc.h \
358stralloc_opys.c
359	./compile stralloc_opys.c
360
361stralloc_pend.o: alloc.h compile gen_alloc.h gen_allocdefs.h \
362stralloc.h stralloc_pend.c
363	./compile stralloc_pend.c
364
365strerr_die.o: buffer.h compile strerr.h strerr_die.c
366	./compile strerr_die.c
367
368strerr_sys.o: compile error.h strerr.h strerr_sys.c
369	./compile strerr_sys.c
370
371subgetopt.o: compile subgetopt.c subgetopt.h
372	./compile subgetopt.c
373
374sysdeps: compile direntry.h hasflock.h hasmkffo.h hassgact.h \
375hassgprm.h hasshsgr.h haswaitp.h iopause.h load select.h systype \
376uint64.h reboot_system.h uw_tmp.h socket.lib
377	rm -f sysdeps
378	cat systype compile load socket.lib >>sysdeps
379	grep sysdep direntry.h >>sysdeps
380	grep sysdep haswaitp.h >>sysdeps
381	grep sysdep hassgact.h >>sysdeps
382	grep sysdep hassgprm.h >>sysdeps
383	grep sysdep select.h >>sysdeps
384	grep sysdep uint64.h >>sysdeps
385	grep sysdep iopause.h >>sysdeps
386	grep sysdep hasmkffo.h >>sysdeps
387	grep sysdep hasflock.h >>sysdeps
388	grep sysdep hasshsgr.h >>sysdeps
389	grep sysdep reboot_system.h >>sysdeps
390	grep sysdep uw_tmp.h >>sysdeps
391	cat sysdeps
392
393systype: find-systype.sh trycpp.c x86cpuid.c
394	sh find-systype.sh > systype
395
396tai_now.o: compile tai.h tai_now.c uint64.h
397	./compile tai_now.c
398
399tai_pack.o: compile tai.h tai_pack.c uint64.h
400	./compile tai_pack.c
401
402tai_sub.o: compile tai.h tai_sub.c uint64.h
403	./compile tai_sub.c
404
405tai_unpack.o: compile tai.h tai_unpack.c uint64.h
406	./compile tai_unpack.c
407
408taia_add.o: compile tai.h taia.h taia_add.c uint64.h
409	./compile taia_add.c
410
411taia_approx.o: compile tai.h taia.h taia_approx.c uint64.h
412	./compile taia_approx.c
413
414taia_frac.o: compile tai.h taia.h taia_frac.c uint64.h
415	./compile taia_frac.c
416
417taia_less.o: compile tai.h taia.h taia_less.c uint64.h
418	./compile taia_less.c
419
420taia_now.o: compile tai.h taia.h taia_now.c uint64.h
421	./compile taia_now.c
422
423taia_pack.o: compile tai.h taia.h taia_pack.c uint64.h
424	./compile taia_pack.c
425
426taia_sub.o: compile tai.h taia.h taia_sub.c uint64.h
427	./compile taia_sub.c
428
429taia_uint.o: compile tai.h taia.h taia_uint.c uint64.h
430	./compile taia_uint.c
431
432time.a: iopause.o makelib tai_now.o tai_pack.o tai_sub.o tai_unpack.o \
433taia_add.o taia_approx.o taia_frac.o taia_less.o taia_now.o \
434taia_pack.o taia_sub.o taia_uint.o
435	./makelib time.a iopause.o tai_now.o tai_pack.o tai_sub.o \
436	tai_unpack.o taia_add.o taia_approx.o taia_frac.o taia_less.o \
437	taia_now.o taia_pack.o taia_sub.o taia_uint.o
438
439uint64.h: choose compile load tryulong64.c uint64.h1 uint64.h2
440	./choose clr tryulong64 uint64.h1 uint64.h2 > uint64.h
441
442unix.a: alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o buffer_2.o \
443buffer_get.o buffer_put.o buffer_read.o buffer_write.o coe.o env.o \
444error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o lock_exnb.o \
445makelib ndelay_off.o ndelay_on.o open_append.o open_read.o \
446open_trunc.o open_write.o openreadclose.o pathexec_env.o \
447pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \
448sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \
449stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \
450stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \
451wait_pid.o
452	./makelib unix.a alloc.o alloc_re.o buffer.o buffer_0.o buffer_1.o \
453	buffer_2.o buffer_get.o buffer_put.o buffer_read.o buffer_write.o \
454	coe.o env.o error.o error_str.o fd_copy.o fd_move.o fifo.o lock_ex.o \
455	lock_exnb.o ndelay_off.o ndelay_on.o open_append.o open_read.o \
456	open_trunc.o open_write.o openreadclose.o pathexec_env.o \
457	pathexec_run.o prot.o readclose.o seek_set.o sgetopt.o sig.o \
458	sig_block.o sig_catch.o sig_pause.o stralloc_cat.o stralloc_catb.o \
459	stralloc_cats.o stralloc_eady.o stralloc_opyb.o stralloc_opys.o \
460	stralloc_pend.o strerr_die.o strerr_sys.o subgetopt.o wait_nohang.o \
461	wait_pid.o
462
463wait_nohang.o: compile haswaitp.h wait_nohang.c
464	./compile wait_nohang.c
465
466wait_pid.o: compile error.h haswaitp.h wait_pid.c
467	./compile wait_pid.c
468
469