1# Don't edit Makefile! Use conf-* for configuration.
2
3SHELL=/bin/sh
4
5default: it
6
7auto-ccld.sh: \
8conf-cc conf-ld warn-auto.sh
9	( cat warn-auto.sh; \
10	echo CC=\'`head -1 conf-cc`\'; \
11	echo LD=\'`head -1 conf-ld`\' \
12	) > auto-ccld.sh
13
14auto-str: \
15load auto-str.o substdio.a error.a str.a
16	./load auto-str substdio.a error.a str.a
17
18auto-str.o: \
19compile auto-str.c substdio.h readwrite.h exit.h
20	./compile auto-str.c
21
22auto_home.c: \
23auto-str conf-home
24	./auto-str auto_home `head -1 conf-home` > auto_home.c
25
26auto_home.o: \
27compile auto_home.c
28	./compile auto_home.c
29
30byte_copy.o: \
31compile byte_copy.c byte.h
32	./compile byte_copy.c
33
34byte_cr.o: \
35compile byte_cr.c byte.h
36	./compile byte_cr.c
37
38check: \
39it instcheck
40	./instcheck
41
42compile: \
43make-compile warn-auto.sh systype
44	( cat warn-auto.sh; ./make-compile "`cat systype`" ) > \
45	compile
46	chmod 755 compile
47
48eratspeed: \
49load eratspeed.o
50	./load eratspeed
51
52eratspeed.o: \
53compile eratspeed.c timing.h hasrdtsc.h hasgethr.h uint32.h
54	./compile eratspeed.c
55
56error.a: \
57makelib error.o error_str.o
58	./makelib error.a error.o error_str.o
59
60error.o: \
61compile error.c error.h
62	./compile error.c
63
64error_str.o: \
65compile error_str.c error.h
66	./compile error_str.c
67
68find-systype: \
69find-systype.sh auto-ccld.sh
70	cat auto-ccld.sh find-systype.sh > find-systype
71	chmod 755 find-systype
72
73fs64.o: \
74compile fs64.c fs64.h uint64.h
75	./compile fs64.c
76
77hasgethr.h: \
78trygethr.c compile load
79	( ( ./compile trygethr.c && ./load trygethr ) >/dev/null \
80	2>&1 \
81	&& echo \#define HASGETHRTIME 1 || exit 0 ) > hasgethr.h
82	rm -f trygethr.o
83
84hasrdtsc.h: \
85tryrdtsc.c compile load
86	( ( ./compile tryrdtsc.c && ./load tryrdtsc && ./tryrdtsc \
87	) >/dev/null 2>&1 \
88	&& echo \#define HASRDTSC 1 || exit 0 ) > hasrdtsc.h
89	rm -f tryrdtsc.o tryrdtsc
90
91hier.o: \
92compile hier.c auto_home.h
93	./compile hier.c
94
95install: \
96load install.o hier.o auto_home.o strerr.a substdio.a open.a error.a \
97str.a
98	./load install hier.o auto_home.o strerr.a substdio.a \
99	open.a error.a str.a
100
101install.o: \
102compile install.c substdio.h strerr.h error.h open.h readwrite.h \
103exit.h
104	./compile install.c
105
106instcheck: \
107load instcheck.o hier.o auto_home.o strerr.a substdio.a error.a str.a
108	./load instcheck hier.o auto_home.o strerr.a substdio.a \
109	error.a str.a
110
111instcheck.o: \
112compile instcheck.c strerr.h error.h readwrite.h exit.h
113	./compile instcheck.c
114
115int64.h: \
116trylong64.c compile load int64.h1 int64.h2
117	( ( ./compile trylong64.c && ./load trylong64 && \
118	./trylong64 ) >/dev/null 2>&1 \
119	&& cat int64.h1 || cat int64.h2 ) > int64.h
120	rm -f trylong64.o trylong64
121
122it: \
123man prog
124
125load: \
126make-load warn-auto.sh systype
127	( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
128	chmod 755 load
129
130make-compile: \
131make-compile.sh auto-ccld.sh
132	cat auto-ccld.sh make-compile.sh > make-compile
133	chmod 755 make-compile
134
135make-load: \
136make-load.sh auto-ccld.sh
137	cat auto-ccld.sh make-load.sh > make-load
138	chmod 755 make-load
139
140make-makelib: \
141make-makelib.sh auto-ccld.sh
142	cat auto-ccld.sh make-makelib.sh > make-makelib
143	chmod 755 make-makelib
144
145makelib: \
146make-makelib warn-auto.sh systype
147	( cat warn-auto.sh; ./make-makelib "`cat systype`" ) > \
148	makelib
149	chmod 755 makelib
150
151man: \
152primes.0 primespeed.0 primegaps.0 primegen.0
153
154open.a: \
155makelib open_read.o open_trunc.o
156	./makelib open.a open_read.o open_trunc.o
157
158open_read.o: \
159compile open_read.c open.h
160	./compile open_read.c
161
162open_trunc.o: \
163compile open_trunc.c open.h
164	./compile open_trunc.c
165
166primegaps: \
167load primegaps.o fs64.o libprimegen.a math.lib
168	./load primegaps fs64.o libprimegen.a  `cat math.lib`
169
170primegaps.0: \
171primegaps.1
172	nroff -man primegaps.1 > primegaps.0
173
174primegaps.o: \
175compile primegaps.c primegen.h uint32.h uint64.h
176	./compile primegaps.c
177
178primegen.0: \
179primegen.3
180	nroff -man primegen.3 > primegen.0
181
182libprimegen.a: \
183makelib primegen.o primegen_init.o primegen_next.o primegen_skip.o
184	./makelib libprimegen.a primegen.o primegen_init.o \
185	primegen_next.o primegen_skip.o
186
187primegen.h: \
188conf-words primegen.h.sed
189	sed s/conf-words/`head -1 conf-words`/ \
190	< primegen.h.sed > primegen.h
191
192primegen.o: \
193compile primegen.c primegen.h uint32.h uint64.h primegen_impl.h \
194int64.h
195	./compile primegen.c
196
197primegen_init.o: \
198compile primegen_init.c primegen.h uint32.h uint64.h primegen_impl.h
199	./compile primegen_init.c
200
201primegen_next.o: \
202compile primegen_next.c primegen.h uint32.h uint64.h primegen_impl.h
203	./compile primegen_next.c
204
205primegen_skip.o: \
206compile primegen_skip.c primegen.h uint32.h uint64.h primegen_impl.h
207	./compile primegen_skip.c
208
209primes: \
210load primes.o fs64.o libprimegen.a
211	./load primes fs64.o libprimegen.a
212
213primes.0: \
214primes.1
215	nroff -man primes.1 > primes.0
216
217primes.o: \
218compile primes.c primegen.h uint32.h uint64.h fs64.h uint64.h
219	./compile primes.c
220
221primespeed: \
222load primespeed.o fs64.o libprimegen.a
223	./load primespeed fs64.o libprimegen.a
224
225primespeed.0: \
226primespeed.1
227	nroff -man primespeed.1 > primespeed.0
228
229primespeed.o: \
230compile primespeed.c timing.h hasrdtsc.h hasgethr.h primegen.h \
231uint32.h uint64.h primegen_impl.h fs64.h uint64.h
232	./compile primespeed.c
233
234prog: \
235primes primespeed primegaps eratspeed
236
237setup: \
238it install
239	./install
240
241shar: \
242FILES BLURB README TODO THANKS CHANGES FILES TARGETS VERSION SYSDEPS \
243Makefile INSTALL primes.1 primes.c primespeed.1 primespeed.c \
244primegaps.1 primegaps.c primegen.3 conf-words primegen.h.sed \
245primegen_impl.h primegen.c primegen_init.c primegen_next.c \
246primegen_skip.c eratspeed.c fs64.h fs64.c math.lib hier.c conf-home \
247auto-str.c auto_home.h install.c instcheck.c conf-cc conf-ld \
248find-systype.sh make-compile.sh make-load.sh make-makelib.sh trycpp.c \
249warn-auto.sh substdio.h substdio.c substdi.c substdo.c \
250substdio_copy.c subfd.h subfderr.c readwrite.h exit.h strerr.h \
251strerr_sys.c strerr_die.c error.3 error_str.3 error.h error.c \
252error_str.c open.h open_read.c open_trunc.c byte.h byte_copy.c \
253byte_cr.c str.h str_len.c uint32.h1 uint32.h2 tryulong32.c uint64.h1 \
254uint64.h2 tryulong64.c int64.h1 int64.h2 trylong64.c timing.h \
255tryrdtsc.c trygethr.c
256	shar -m `cat FILES` > shar
257	chmod 400 shar
258
259str.a: \
260makelib str_len.o byte_copy.o byte_cr.o
261	./makelib str.a str_len.o byte_copy.o byte_cr.o
262
263str_len.o: \
264compile str_len.c str.h
265	./compile str_len.c
266
267strerr.a: \
268makelib strerr_sys.o strerr_die.o
269	./makelib strerr.a strerr_sys.o strerr_die.o
270
271strerr_die.o: \
272compile strerr_die.c substdio.h subfd.h substdio.h exit.h strerr.h
273	./compile strerr_die.c
274
275strerr_sys.o: \
276compile strerr_sys.c error.h strerr.h
277	./compile strerr_sys.c
278
279subfderr.o: \
280compile subfderr.c readwrite.h substdio.h subfd.h substdio.h
281	./compile subfderr.c
282
283substdi.o: \
284compile substdi.c substdio.h byte.h error.h
285	./compile substdi.c
286
287substdio.a: \
288makelib substdio.o substdi.o substdo.o subfderr.o substdio_copy.o
289	./makelib substdio.a substdio.o substdi.o substdo.o \
290	subfderr.o substdio_copy.o
291
292substdio.o: \
293compile substdio.c substdio.h
294	./compile substdio.c
295
296substdio_copy.o: \
297compile substdio_copy.c substdio.h
298	./compile substdio_copy.c
299
300substdo.o: \
301compile substdo.c substdio.h str.h byte.h error.h
302	./compile substdo.c
303
304systype: \
305find-systype trycpp.c
306	./find-systype > systype
307
308uint32.h: \
309tryulong32.c compile load uint32.h1 uint32.h2
310	( ( ./compile tryulong32.c && ./load tryulong32 && \
311	./tryulong32 ) >/dev/null 2>&1 \
312	&& cat uint32.h2 || cat uint32.h1 ) > uint32.h
313	rm -f tryulong32.o tryulong32
314
315uint64.h: \
316tryulong64.c compile load uint64.h1 uint64.h2
317	( ( ./compile tryulong64.c && ./load tryulong64 && \
318	./tryulong64 ) >/dev/null 2>&1 \
319	&& cat uint64.h1 || cat uint64.h2 ) > uint64.h
320	rm -f tryulong64.o tryulong64
321