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