MFC: An off-by-one malloc size was corrupting the installer's memory,
[dragonfly.git] / contrib / opie / Makefile.in
blob77e0fc3b1bb1f337300226a78db307cf54179ab4
1 ##
2 # Makefile.source and Makefile: Directions for building and installing OPIE.
4 # %%% portions-copyright-cmetz-96
5 # Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
6 # Reserved. The Inner Net License Version 2 applies to these portions of
7 # the software.
8 # You should have received a copy of the license with this software. If
9 # you didn't get a copy, you may request one from <license@inner.net>.
11 # Portions of this software are Copyright 1995 by Randall Atkinson and Dan
12 # McDonald, All Rights Reserved. All Rights under this copyright are assigned
13 # to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
14 # License Agreement applies to this software.
16 # History:
18 # Modified by cmetz for OPIE 2.4. Add libmissing to include header path.
19 # Renamed realclean to distclean. Added opieauto rules. Made
20 # system program install more tolerant of non-existent files.
21 # Modified by cmetz for OPIE 2.31. Moved logwtmp.o into libopie.
22 # Modified by cmetz for OPIE 2.3. Removed manual config -- it's
23 # Autoconf or bust. Replaced user configuration options
24 # with options.h. Eliminated unused variables. Pass down
25 # $(DEBUG) instead of several other variables to the
26 # subdirs. Extended/standard key file support. Added
27 # dependencies on subdir files. Made opietest call silent.
28 # Removed opie-md4, opie-md5, and key aliases. Removed
29 # test target. Make uninstall remove man page aliases.
30 # Modified by cmetz for OPIE 2.22. Removed @LIBOBJS@ from MISSING for
31 # Autoconf target. Re-ordered LFLAGS because some ld's won't
32 # include libmissing properly if it's not at the end.
33 # Modified by cmetz for OPIE 2.21. Added getusershell.o to IRIX
34 # missing functions.
35 # Modified by cmetz for OPIE 2.2. Added NEW_PROMPTS definition.
36 # Added MISSING and new flags-passing for libmissing.
37 # Quote MISSING or lose. Update TEST target for FTPD
38 # variable. Removed line formatting for compile commands
39 # since macro expansion confuses the issue anyway.
40 # Added targets for opieserv. Added targets for opietest.
41 # Removed obselete options.h target. Swapped libmissing
42 # and libopie. Updated manual config options. Added more
43 # explanatory text. Fixed uses of old SYSV and BSD4_3
44 # symbols.
45 # Modified at NRL for OPIE 2.2: Renamed LDFLAGS setting to LIBS,
46 # renamed LDFLAGS in targets to LFLAGS. Added targets for
47 # libopie and libmissing directories. Got rid of PROTOTYPES.
48 # Added opiegen. Fixed RANLIB Autoconf target.
49 # Modified at NRL for OPIE 2.11: Fixed fatal mistype of Autoconf.
50 # Modified at NRL for OPIE 2.1: Changed targets to reflect source
51 # file name changes. Changed explanation and flags for static
52 # linking. Changed opieinfo target. Removed WHOAMI. Added
53 # Autoconf targets. Changed if conditionals to use test
54 # instead of [. Changed SU_DIR to SU to help autoconf.
55 # Changed FTPDIR and FTPDNAME to FTPD to help autoconf.
56 # Changed HP-UX to HP-UX9 and HP-UX10. Make uninstall
57 # target depend on config. HPUX *is* no longer necessary, but
58 # something does have to be there. Sub in Autoconf @CC@.
59 # Modified at NRL for OPIE 2.04: Re-worded explanation of SU_STAR_CHECK.
60 # Modified at NRL for OPIE 2.02: Added SU_STAR_CHECK flag.
61 # Modified at NRL for OPIE 2.01: Test target makes opiesu and opielogin
62 # setuid. install target clears that. uninstall target needs to
63 # remove the opiekey symlinks. opieinfo target needs to
64 # substitute for $(EXISTS). ifdefs target needs to check for
65 # starting hash. $(LFLAGS) and -o should be at the end of all
66 # link commands to spoon-feed drain bamaged link editors. Added
67 # A/UX defaults.
68 # Modified heavily at NRL for OPIE 2.0.
69 # Written at Bellcore for the S/Key Version 1 software distribution
70 # (Makefile).
72 #============================================================================
73 # CONFIGURATION PARAMETERS -- CHANGE THESE TO SUIT YOUR MACHINE
75 # Shell to use for make(1)
76 # It's usually a good idea to leave this as-is. On some systems, ksh or bash
77 # may be necessary
78 SHELL=/bin/sh
80 # OWNER is the username who should own the OPIE binaries.
81 # GROUP is the groupname associated with the OPIE binaries.
83 OWNER=0
84 GROUP=bin
86 # Where should the OPIE standard and extended databases be stored?
88 # Some sites might want to put this elsewhere. If you want to use an old
89 # S/Key database, you should create a link from /etc/skeykeys to /etc/opiekeys.
90 KEY_FILE=/etc/opiekeys
92 # Are we debugging?
94 # The first line will build a normal version of OPIE. You should use it.
96 # The second is for brave souls porting OPIE to a new system or trying to
97 # debug it and should definitely NOT be used to build a production copy
98 # of OPIE.
100 # The third is the above using nifty heap debugger called "Electric Fence".
101 DEBUG=-O
102 #DEBUG=-DDEBUG=1 -g
103 #DEBUG=-DDEBUG=1 -g -lefence
105 # These parameters are determined by Autoconf and are probably correct.
106 # If OPIE doesn't build or work right, try tweaking these.
107 CC=@CC@
108 YACC=@YACC@
109 FTPD=@FTPD@
110 LIBS=@LIBS@
111 OPTIONS=@DEFS@
112 EXISTS=@EXISTS@
113 MKDIR=@MKDIR@
114 CHOWN=@CHOWN@
115 LOCALBIN=@LOCALBIN@
116 LOCALMAN=@LOCALMAN@
117 SU=@SU@
118 ALT_SU=@ALT_SU@
119 LOGIN=@LOGIN@
120 LOCK_DIR=@LOCK_DIR@
121 OPIEAUTO=@OPIEAUTO@
123 BACKUP=opie.old
125 CFLAGS=$(DEBUG) -Ilibmissing
127 LFLAGS=-Llibopie -Llibmissing -lopie $(LIBS) -lmissing -lopie
128 LDEPS=libmissing/libmissing.a libopie/libopie.a
130 all: client server
132 ifdefs:
133 egrep '^#*if*def' *.c *.h | cut -f2 -d: | sort | uniq
135 client: libopie/libopie.a libmissing/libmissing.a opietest-passed opiekey opiegen $(OPIEAUTO)
137 client-install: client
138 @echo "Installing OPIE client software..."
139 @echo "Copying OPIE key-related files"
140 @if test ! -d $(LOCALBIN); then $(MKDIR) $(LOCALBIN); chmod 755 $(LOCALBIN); fi
141 @cp opiekey $(OPIEAUTO) $(LOCALBIN)
142 @$(CHOWN) $(OWNER) $(LOCALBIN)/opiekey
143 @if test ! -z "$(OPIEAUTO)"; then $(CHOWN) $(OWNER) $(LOCALBIN)/opieauto; fi
144 @chgrp $(GROUP) $(LOCALBIN)/opiekey
145 @echo "Changing file permissions"
146 @chmod 0511 $(LOCALBIN)/opiekey
147 @if test ! -z "$(OPIEAUTO)"; then chmod 0511 $(LOCALBIN)/opieauto; fi
148 @echo "Symlinking aliases to opiekey"
149 @-ln -s $(LOCALBIN)/opiekey $(LOCALBIN)/otp-md4
150 @-ln -s $(LOCALBIN)/opiekey $(LOCALBIN)/otp-md5
151 @echo "Installing manual pages"
152 @-for i in otp-md4 otp-md5; do ln -s opiekey.1 $(LOCALMAN)/man1/$$i.1; done
153 @if test ! -d $(LOCALMAN)/man1; then $(MKDIR) $(LOCALMAN)/man1; chmod 755 $(LOCALMAN)/man1; fi; cp opiekey.1 $(LOCALMAN)/man1/opiekey.1; $(CHOWN) $(OWNER) $(LOCALMAN)/man1/opiekey.1; chgrp $(GROUP) $(LOCALMAN)/man1/opiekey.1; chmod 644 $(LOCALMAN)/man1/opiekey.1
155 server: libopie/libopie.a libmissing/libmissing.a opietest-passed opielogin opiesu opiepasswd opieinfo opieftpd opieserv
157 server-install: server
158 @echo "Installing OPIE server software..."
159 @echo "Copying OPIE user programs"
160 @if test ! -d $(LOCALBIN); then $(MKDIR) $(LOCALBIN); chmod 755 $(LOCALBIN); fi
161 @cp opiepasswd opieinfo $(LOCALBIN)
162 @echo "Changing ownership"
163 @$(CHOWN) $(OWNER) $(LOCALBIN)/opiepasswd $(LOCALBIN)/opieinfo
164 @chgrp $(GROUP) $(LOCALBIN)/opiepasswd $(LOCALBIN)/opieinfo
165 @echo "Changing file permissions"
166 @chmod 0555 $(LOCALBIN)/opieinfo
167 @chmod 4511 $(LOCALBIN)/opiepasswd
168 @echo "Installing OPIE system programs..."
169 @if test ! -z $(LOGIN); \
170 then \
171 if test ! $(EXISTS) $(LOGIN).$(BACKUP); \
172 then \
173 echo "Renaming existing $(LOGIN) to $(LOGIN).$(BACKUP)"; \
174 mv $(LOGIN) $(LOGIN).$(BACKUP); \
175 echo "Clearing permissions on $(LOGIN)"; \
176 chmod 0 $(LOGIN).$(BACKUP); \
177 fi; \
178 echo "Copying OPIE login to $(LOGIN)"; \
179 cp opielogin $(LOGIN); \
180 echo "Changing ownership of $(LOGIN)"; \
181 $(CHOWN) $(OWNER) $(LOGIN); \
182 chgrp $(GROUP) $(LOGIN); \
183 echo "Changing file permissions of $(LOGIN)"; \
184 chmod 4111 $(LOGIN); \
186 @if test ! -z $(SU); \
187 then \
188 if test ! $(EXISTS) $(SU).$(BACKUP); \
189 then \
190 echo "Renaming existing $(SU) to $(SU).$(BACKUP)"; \
191 mv $(SU) $(SU).$(BACKUP); \
192 echo "Clearing permissions on $(SU)"; \
193 chmod 0 $(SU).$(BACKUP); \
194 fi; \
195 echo "Copying OPIE su to $(SU)"; \
196 cp opiesu $(SU); \
197 echo "Changing ownership of $(SU)"; \
198 $(CHOWN) $(OWNER) $(SU); \
199 chgrp $(GROUP) $(SU); \
200 echo "Changing file permissions of $(SU)"; \
201 chmod 4111 $(SU); \
203 @if test ! -z $(ALT_SU); \
204 then \
205 if test ! $(EXISTS) $(ALT_SU).$(BACKUP); \
206 then \
207 echo "Renaming existing $(ALT_SU) to $(ALT_SU).$(BACKUP)"; \
208 mv $(ALT_SU) $(ALT_SU).$(BACKUP); \
209 echo "Clearing permissions on $(ALT_SU)"; \
210 chmod 0 $(ALT_SU).$(BACKUP); \
211 fi; \
212 echo "Copying OPIE su to $(ALT_SU)"; \
213 cp opiesu $(ALT_SU); \
214 echo "Changing ownership of $(ALT_SU)"; \
215 $(CHOWN) $(OWNER) $(ALT_SU); \
216 chgrp $(GROUP) $(ALT_SU); \
217 echo "Changing file permissions of $(ALT_SU)"; \
218 chmod 4111 $(ALT_SU); \
220 @if test ! -z $(FTPD); \
221 then \
222 if test ! $(EXISTS) $(FTPD).$(BACKUP); \
223 then \
224 echo "Renaming existing $(FTPD) to $(FTPD).$(BACKUP)"; \
225 mv $(FTPD) $(FTPD).$(BACKUP); \
226 echo "Clearing permissions on $(FTPD).$(BACKUP)"; \
227 chmod 0 $(FTPD).$(BACKUP); \
228 fi; \
229 echo "Copying OPIE ftp daemon to $(FTPD)"; \
230 cp opieftpd $(FTPD); \
231 echo "Changing ownership of $(FTPD)"; \
232 $(CHOWN) $(OWNER) $(FTPD); \
233 chgrp $(GROUP) $(FTPD); \
234 echo "Changing file permissions of $(FTPD)"; \
235 chmod 0100 $(FTPD); \
237 @echo "Making sure OPIE database file exists";
238 @touch $(KEY_FILE)
239 @echo "Changing permissions of OPIE database file"
240 @chmod 0644 $(KEY_FILE)
241 @echo "Changing ownership of OPIE database file"
242 @$(CHOWN) $(OWNER) $(KEY_FILE)
243 @chgrp $(GROUP) $(KEY_FILE)
244 @-if test ! -z "$(LOCK_DIR)"; then echo "Creating OPIE lock directory"; mkdir $(LOCK_DIR); $(CHOWN) 0 $(LOCK_DIR); chgrp 0 $(LOCK_DIR); chmod 0700 $(LOCK_DIR); fi;
245 @-if test ! -z "$(ACCESS_FILE)"; then echo "Creating OPIE access file (don't say we didn't warn you)"; touch $(ACCESS_FILE); $(CHOWN) 0 $(ACCESS_FILE); chgrp 0 $(ACCESS_FILE); chmod 0444 $(ACCESS_FILE); fi;
246 @echo "Installing manual pages"
247 @if test ! -d $(LOCALMAN); then $(MKDIR) $(LOCALMAN); chmod 755 $(LOCALMAN); fi
248 @for i in 1 4 5 8; do for j in *.$$i; do if test ! -d $(LOCALMAN)/man$$i; then $(MKDIR) $(LOCALMAN)/man$$i; chmod 755 $(LOCALMAN)/man$$i; fi; cp $$j $(LOCALMAN)/man$$i/$$j; $(CHOWN) $(OWNER) $(LOCALMAN)/man$$i/$$j; chgrp $(GROUP) $(LOCALMAN)/man$$i/$$j; chmod 644 $(LOCALMAN)/man$$i/$$j; done; done
249 @echo "REMEMBER to run opiepasswd on your users immediately."
251 install: client-install server-install
253 uninstall:
254 @echo "Un-installing OPIE..."
255 @echo "Removing symlinks"
256 @-for i in otp-md4 otp-md5; do rm $(LOCALBIN)/$$i; done
257 @echo "Removing OPIE programs"
258 @-for i in opiekey opiepasswd opieinfo; do rm $(LOCALBIN)/$$i; done
259 @echo "Removing OPIE manual pages"
260 @-for i in 1 4 5 8; do for j in *.$$i; do rm $(LOCALMAN)/man$$i/$$j; done; done
261 @-rm $(LOCALMAN)/man1/otp-md4.1 $(LOCALMAN)/man1/otp-md5.1
262 @echo "Restoring old binaries"
263 @-for i in $(SU) $(ALT_SU) $(LOGIN) $(FTPD); do FILE=`basename $$i`; if test ! $(EXISTS) $$i.$(BACKUP); then echo "No $$i.$(BACKUP)! Aborting."; exit 1; else echo "Removing $$FILE"; rm $$i || true; echo "Restoring old $$FILE"; mv $$i.$(BACKUP) $$i; fi; done
264 @echo "Resetting permissions"
265 @chmod 4111 $(SU) $(LOGIN)
266 @chmod 0100 $(FTPD)
267 @if test ! -z "$(ALT_SU)"; then chmod 4111 $(ALT_SU); fi
268 @echo "OPIE is now un-installed."
269 @echo "Please verify by hand that this process worked."
271 opietest-passed: opietest
272 -./opietest && touch opietest-passed
274 libopie/libopie.a: libopie/*.c *.h
275 (cd libopie ; $(MAKE) libopie.a CFL='$(CFLAGS) -DKEY_FILE=\"$(KEY_FILE)\"')
277 libmissing/libmissing.a: libmissing/*.c
278 (cd libmissing ; $(MAKE) libmissing.a CFL='$(CFLAGS)')
280 clean:
281 -rm -f *.o opiekey opiegen opielogin opiepasswd opiesu opieftpd
282 -rm -f opieserv opieinfo opietest opieauto *core* opietest-passed
283 -rm -f Makefile.munge configure.munger y.tab.c .gdb*
284 (cd libopie ; $(MAKE) clean)
285 (cd libmissing ; $(MAKE) clean)
287 realclean: distclean
289 distclean: clean
290 -rm -f *~ core* "\#*\#" Makefile make.log
291 -rm -f config.log config.status config.cache config.h
292 (cd libopie ; $(MAKE) distclean)
293 (cd libmissing ; $(MAKE) distclean)
295 opiekey: opiekey.o $(LDEPS)
296 $(CC) $(CFLAGS) opiekey.o $(LFLAGS) -o opiekey
298 opiegen: opiegen.o $(LDEPS)
299 $(CC) $(CFLAGS) opiegen.o $(LFLAGS) -o opiegen
301 opieserv: opieserv.o $(LDEPS)
302 $(CC) $(CFLAGS) opieserv.o $(LFLAGS) -o opieserv
304 opieftpd: opieftpd.o glob.o popen.o y.tab.o $(LDEPS)
305 $(CC) $(CFLAGS) opieftpd.o glob.o popen.o y.tab.o $(LFLAGS) -o opieftpd
307 opielogin: opielogin.o permsfile.o $(LDEPS)
308 $(CC) $(CFLAGS) opielogin.o permsfile.o $(LFLAGS) -o opielogin
310 opiepasswd: opiepasswd.o $(LDEPS)
311 $(CC) $(CFLAGS) opiepasswd.o $(LFLAGS) -o opiepasswd
313 opiesu: opiesu.o $(LDEPS)
314 $(CC) $(CFLAGS) opiesu.o $(LFLAGS) -o opiesu
316 y.tab.c: ftpcmd.y
317 $(YACC) ftpcmd.y
319 opieinfo: opieinfo.o $(LDEPS)
320 $(CC) $(CFLAGS) opieinfo.o $(LFLAGS) -o opieinfo
322 opietest: opietest.o $(LDEPS)
323 $(CC) $(CFLAGS) opietest.o $(LFLAGS) -o opietest
325 opieauto: opieauto.o $(LDEPS)
326 $(CC) $(CFLAGS) opieauto.o $(LFLAGS) -o opieauto