1# Don't edit Makefile!  Use conf-* for configuration.
2#
3# Generated by spac see http://untroubled.org/spac/
4
5SHELL=/bin/sh
6
7DEFAULT: all
8
9all: libraries programs docs
10
11backend.a: makelib backend.o copy.o list.o messagefile.o path.o retr.o socket.o stat.o statmod.o state.o store.o
12	./makelib backend.a backend.o copy.o list.o messagefile.o path.o retr.o socket.o stat.o statmod.o state.o store.o
13
14backend.o: compile backend.c twoftpd.h backend.h
15	./compile backend.c
16
17banner.o: compile banner.c twoftpd.h
18	./compile banner.c
19
20clean: TARGETS
21	rm -f `cat TARGETS`
22
23clean-spac: clean AUTOFILES
24	rm -f `cat AUTOFILES`
25
26compile: conf-cc conf-bgincs
27	( bgincs=`head -n 1 conf-bgincs`; \
28	  echo '#!/bin/sh'; \
29	  echo 'source=$$1; shift'; \
30	  echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \
31	  echo exec `head -n 1 conf-cc` -I. "-I'$${bgincs}'" '-o $${base}.o -c $$source $${1+"$$@"}'; \
32	) >compile
33	chmod 755 compile
34
35conf.o: compile conf.c conf.h
36	./compile conf.c
37
38conf_bin.c: conf-bin
39	head -n 1 conf-bin | \
40	  sed -e 's/"/\\"/g' \
41	      -e 's/^/const char conf_bin[] = "/' \
42	      -e 's/$$/";/' >conf_bin.c
43
44copy.o: compile copy.c backend.h
45	./compile copy.c
46
47docs: twoftpd-auth.1.html twoftpd-switch.1.html twoftpd-xfer.1.html
48
49install: INSTHIER conf-bin conf-man
50	bg-installer -v <INSTHIER
51	bg-installer -c <INSTHIER
52
53libraries: backend.a main.a
54
55list.o: compile list.c twoftpd.h backend.h
56	./compile list.c
57
58load: conf-ld conf-bglibs
59	( bglibs=`head -n 1 conf-bglibs`; \
60	  echo '#!/bin/sh';\
61	  echo 'main="$$1"; shift';\
62	  echo exec `head -n 1 conf-ld` -L. "-L'$${bglibs}'" "-Wl,-R'$${bglibs}'" '-o "$$main" "$$main.o" $${1+"$$@"}'; \
63	) >load
64	chmod 755 load
65
66log.o: compile log.c log.h
67	./compile log.c
68
69main.a: makelib banner.o log.o main.o respond.o responses.o strtou.o
70	./makelib main.a banner.o log.o main.o respond.o responses.o strtou.o
71
72main.o: compile main.c twoftpd.h log.h
73	./compile main.c
74
75makelib:
76	( echo '#!/bin/sh'; \
77	  echo 'lib="$$1"; shift';\
78	  echo 'rm -f "$$lib"';\
79	  echo 'ar cr "$$lib" $${1+"$$@"}';\
80	  echo 'ranlib "$$lib"';\
81	) >makelib
82	chmod 755 makelib
83
84messagefile.o: compile messagefile.c twoftpd.h backend.h
85	./compile messagefile.c
86
87path.o: compile path.c twoftpd.h backend.h
88	./compile path.c
89
90programs: twoftpd-conf twoftpd-xfer twoftpd-bind-port twoftpd-anon-conf twoftpd-anon twoftpd-switch twoftpd-drop twoftpd-auth
91
92respond.o: compile respond.c twoftpd.h log.h
93	./compile respond.c
94
95responses.o: compile responses.c twoftpd.h
96	./compile responses.c
97
98retr.o: compile retr.c twoftpd.h backend.h
99	./compile retr.c
100
101socket.lib: compile load
102	@echo -n 'Checking for socket libraries: '
103	@echo 'main() { ; }' >trylib-lsocket.c
104	@{ ./compile trylib-lsocket.c && ./load trylib-lsocket -lsocket -lnsl; } >/dev/null 2>&1 \
105	  && { echo -lsocket -lnsl >socket.lib; echo -lsocket -lnsl; } \
106	  || { : >socket.lib; echo no; }
107	@rm -f trylib-lsocket.c trylib-lsocket.o trylib-lsocket
108
109socket.o: compile socket.c twoftpd.h backend.h
110	./compile socket.c
111
112stat.o: compile stat.c twoftpd.h backend.h
113	./compile stat.c
114
115state.o: compile state.c twoftpd.h backend.h
116	./compile state.c
117
118statmod.o: compile statmod.c twoftpd.h backend.h
119	./compile statmod.c
120
121store.o: compile store.c twoftpd.h backend.h
122	./compile store.c
123
124strtou.o: compile strtou.c twoftpd.h
125	./compile strtou.c
126
127twoftpd-anon: twoftpd-anon.o load backend.a main.a socket.lib
128	./load twoftpd-anon backend.a main.a -lbg `cat socket.lib`
129
130twoftpd-anon-conf: twoftpd-anon-conf.o load conf.o
131	./load twoftpd-anon-conf conf.o -lbg
132
133twoftpd-anon-conf.o: compile twoftpd-anon-conf.c conf.h conf_bin.c
134	./compile twoftpd-anon-conf.c
135
136twoftpd-anon.o: compile twoftpd-anon.c twoftpd.h backend.h
137	./compile twoftpd-anon.c
138
139twoftpd-auth: twoftpd-auth.o load main.a socket.lib
140	./load twoftpd-auth main.a -lcvm-v2client -lbg `cat socket.lib`
141
142twoftpd-auth.1.html: twoftpd-auth.1
143	man --html='cat %s' ./twoftpd-auth.1 > twoftpd-auth.1.html
144
145twoftpd-auth.o: compile twoftpd-auth.c twoftpd.h
146	./compile twoftpd-auth.c
147
148twoftpd-bind-port: twoftpd-bind-port.o load respond.o log.o
149	./load twoftpd-bind-port respond.o log.o -lbg
150
151twoftpd-bind-port.o: compile twoftpd-bind-port.c twoftpd.h
152	./compile twoftpd-bind-port.c
153
154twoftpd-conf: twoftpd-conf.o load conf.o
155	./load twoftpd-conf conf.o -lbg
156
157twoftpd-conf.o: compile twoftpd-conf.c conf.h conf_bin.c
158	./compile twoftpd-conf.c
159
160twoftpd-drop: twoftpd-drop.o load backend.a main.a socket.lib
161	./load twoftpd-drop backend.a main.a -lbg `cat socket.lib`
162
163twoftpd-drop.o: compile twoftpd-drop.c twoftpd.h backend.h
164	./compile twoftpd-drop.c
165
166twoftpd-switch: twoftpd-switch.o load respond.o log.o
167	./load twoftpd-switch respond.o log.o -lbg
168
169twoftpd-switch.1.html: twoftpd-switch.1
170	man --html='cat %s' ./twoftpd-switch.1 > twoftpd-switch.1.html
171
172twoftpd-switch.o: compile twoftpd-switch.c twoftpd.h conf_bin.c
173	./compile twoftpd-switch.c
174
175twoftpd-xfer: twoftpd-xfer.o load backend.a main.a socket.lib
176	./load twoftpd-xfer backend.a main.a -lbg `cat socket.lib`
177
178twoftpd-xfer.1.html: twoftpd-xfer.1
179	man --html='cat %s' ./twoftpd-xfer.1 > twoftpd-xfer.1.html
180
181twoftpd-xfer.o: compile twoftpd-xfer.c twoftpd.h backend.h
182	./compile twoftpd-xfer.c
183
184