2 # Copyright (c) 1996, 1998-2002 Todd C. Miller <Todd.Miller@courtesan.com>
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # 3. The name of the author may not be used to endorse or promote products
17 # derived from this software without specific prior written permission
20 # 4. Products derived from this software may not be called "Sudo" nor
21 # may "Sudo" appear in their names without specific prior written
22 # permission from the author.
24 # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26 # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27 # THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 # $Sudo: Makefile.in,v 1.225 2002/04/18 15:41:30 millert Exp $
40 #### Start of system configuration section. ####
43 authdir = $(srcdir)/auth
46 # Compiler & tools to use
52 # Our install program supports extra flags...
53 INSTALL = $(SHELL) $(srcdir)/install-sh -c
58 SUDO_LIBS = @SUDO_LIBS@ @AFS_LIBS@ $(LIBS) $(NET_LIBS)
60 # C preprocessor flags
61 CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
63 # Usually -O and/or -g
66 # Flags to pass to the link stage
68 SUDO_LDFLAGS = @SUDO_LDFLAGS@ $(LDFLAGS)
70 # Where to install things...
72 exec_prefix = @exec_prefix@
75 sysconfdir = @sysconfdir@
78 # Directory in which to install sudo.
81 # Directory in which to install visudo
82 visudodir = $(sbindir)
84 # Directory in which to install the sudoers file
85 sudoersdir = $(sysconfdir)
87 # Directory in which to install the man page
89 mansectsu = @mansectsu@
90 mansectform = @mansectform@
91 mandirsu = $(mandir)/$(mantype)$(mansectsu)
92 mandirform = $(mandir)/$(mantype)$(mansectform)
94 # User and group ids the installed files should be "owned" by
98 # User, group, and mode the sudoers file should be "owned" by (configure)
99 sudoers_uid = @SUDOERS_UID@
100 sudoers_gid = @SUDOERS_GID@
101 sudoers_mode = @SUDOERS_MODE@
103 # Pass in paths and uid/gid + OS dependent defined
104 DEFS = @OSDEFS@ -D_PATH_SUDOERS=\"$(sudoersdir)/sudoers\" -D_PATH_SUDOERS_TMP=\"$(sudoersdir)/sudoers.tmp\" -DSUDOERS_UID=$(sudoers_uid) -DSUDOERS_GID=$(sudoers_gid) -DSUDOERS_MODE=$(sudoers_mode)
106 #### End of system configuration section. ####
112 SRCS = alloc.c alloca.c check.c def_data.c defaults.c env.c fileops.c \
113 find_path.c fnmatch.c getcwd.c getspwuid.c goodpath.c \
114 interfaces.c lex.yy.c lsearch.c logging.c parse.c parse.lex \
115 parse.yacc set_perms.c sigaction.c snprintf.c strcasecmp.c strerror.c \
116 sudo.c sudo.tab.c testsudoers.c tgetpass.c utime.c visudo.c \
119 AUTH_SRCS = auth/afs.c auth/aix_auth.c auth/bsdauth.c auth/dce.c auth/fwtk.c \
120 auth/kerb4.c auth/kerb5.c auth/pam.c auth/passwd.c auth/rfc1938.c \
121 auth/secureware.c auth/securid.c auth/sia.c auth/sudo_auth.c
123 HDRS = compat.h def_data.h defaults.h ins_2001.h ins_classic.h ins_csops.h \
124 ins_goons.h insults.h interfaces.h logging.h parse.h sudo.h sudo.tab.h \
125 version.h auth/sudo_auth.h emul/fnmatch.h emul/search.h emul/utime.h
127 AUTH_OBJS = sudo_auth.o @AUTH_OBJS@
129 PARSEOBJS = sudo.tab.o lex.yy.o alloc.o defaults.o
131 SUDOBJS = check.o env.o getspwuid.o goodpath.o fileops.o find_path.o \
132 interfaces.o logging.o parse.o set_perms.o sudo.o tgetpass.o \
133 $(AUTH_OBJS) $(PARSEOBJS)
135 VISUDOBJS = visudo.o fileops.o goodpath.o find_path.o $(PARSEOBJS)
137 TESTOBJS = interfaces.o testsudoers.o $(PARSEOBJS)
139 LIBOBJS = @LIBOBJS@ @ALLOCA@
143 DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES HISTORY INSTALL INSTALL.configure \
144 LICENSE Makefile.in PORTING README RUNSON TODO TROUBLESHOOTING \
145 UPGRADE aclocal.m4 aixcrypt.exp config.guess config.h.in \
146 config.sub configure configure.in def_data.in fnmatch.3 indent.pro \
147 install-sh mkdefaults mkinstalldirs pathnames.h.in sample.pam \
148 sample.syslog.conf sample.sudoers sudo.cat sudo.man.in sudo.pod \
149 sudoers sudoers.cat sudoers.man.in sudoers.pod visudo.cat \
150 visudo.man.in visudo.pod auth/API
152 BINFILES= BUGS CHANGES HISTORY LICENSE README TODO TROUBLESHOOTING \
153 UPGRADE install-sh mkinstalldirs sample.syslog.conf sample.sudoers \
154 sudo sudo.cat sudo.man sudo.pod sudoers sudoers.cat sudoers.man \
155 sudoers.pod visudo visudo.cat visudo.man visudo.pod
157 BINSPECIAL= INSTALL.binary Makefile.binary
159 SUDODEP = $(srcdir)/sudo.h $(srcdir)/compat.h $(srcdir)/defaults.h \
160 $(srcdir)/logging.h config.h def_data.h pathnames.h
162 AUTHDEP = $(SUDODEP) $(authdir)/sudo_auth.h
164 INSDEP = $(srcdir)/ins_2001.h $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \
165 $(srcdir)/ins_goons.h $(srcdir)/insults.h
169 .SUFFIXES: .o .c .h .lex .yacc .man .cat
172 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
176 $(NROFF) -man $< > $(srcdir)/$@
178 sudo: $(SUDOBJS) $(LIBOBJS)
179 $(CC) -o $@ $(SUDOBJS) $(LIBOBJS) $(SUDO_LDFLAGS) $(SUDO_LIBS)
181 visudo: $(VISUDOBJS) $(LIBOBJS)
182 $(CC) -o $@ $(VISUDOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)
184 testsudoers: $(TESTOBJS) $(LIBOBJS)
185 $(CC) -o $@ $(TESTOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)
187 # Uncomment the following if you want "make clean" to clean the parser
188 @DEV@PARSESRCS = sudo.tab.h sudo.tab.c lex.yy.c
190 # Uncomment the following if you intend to modify parse.yacc
191 @DEV@sudo.tab.c sudo.tab.h: parse.yacc
192 @DEV@ rm -f sudo.tab.h sudo.tab.c
193 @DEV@ $(YACC) -d -b sudo $(srcdir)/parse.yacc
195 # Uncomment the following if you intend to modify parse.lex
196 @DEV@lex.yy.c: parse.lex
198 @DEV@ $(LEX) $(srcdir)/parse.lex
200 # Uncomment the following if you intend to modify def_data.in
201 @DEV@def_data.h def_data.c: def_data.in
202 @DEV@ perl $(srcdir)/mkdefaults -o def_data $(srcdir)/def_data.in
204 # Dependencies (not counting auth functions)
205 alloc.o: alloc.c $(SUDODEP)
206 check.o: check.c $(SUDODEP)
207 env.o: env.c $(SUDODEP)
208 fileops.o: fileops.c $(SUDODEP)
209 find_path.o: find_path.c $(SUDODEP)
210 getspwuid.o: getspwuid.c $(SUDODEP)
211 goodpath.o: goodpath.c $(SUDODEP)
212 logging.o: logging.c $(SUDODEP)
213 set_perms.o: set_perms.c $(SUDODEP)
214 tgetpass.o: tgetpass.c $(SUDODEP)
215 visudo.o: visudo.c $(SUDODEP) version.h
216 sudo.o: sudo.c $(SUDODEP) interfaces.h version.h
217 interfaces.o: interfaces.c $(SUDODEP) interfaces.h
218 testsudoers.o: testsudoers.c $(SUDODEP) parse.h interfaces.h
219 parse.o: parse.c $(SUDODEP) parse.h interfaces.h
220 lex.yy.o: lex.yy.c $(SUDODEP) parse.h sudo.tab.h
221 sudo.tab.o: sudo.tab.c $(SUDODEP) parse.h sudo.tab.c sudo.tab.h
222 defaults.o: defaults.c $(SUDODEP) def_data.c auth/sudo_auth.h
223 fnmatch.o: fnmatch.c config.h compat.h emul/fnmatch.h
224 getcwd.o: getcwd.c config.h compat.h
225 lsearch.o: lsearch.c config.h compat.h emul/search.h
226 snprintf.o: snprintf.c config.h compat.h
227 strcasecmp.o: strcasecmp.c config.h
228 strerror.o: strerror.c config.h
229 utime.o: utime.c config.h pathnames.h compat.h emul/utime.h
231 # Authentication functions live in "auth" dir and so need extra care
232 sudo_auth.o: $(authdir)/sudo_auth.c $(AUTHDEP) $(INSDEP)
233 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sudo_auth.c
234 afs.o: $(authdir)/afs.c $(AUTHDEP)
235 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/afs.c
236 aix_auth.o: $(authdir)/aix_auth.c $(AUTHDEP)
237 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/aix_auth.c
238 bsdauth.o: $(authdir)/bsdauth.c $(AUTHDEP)
239 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/bsdauth.c
240 dce.o: $(authdir)/dce.c $(AUTHDEP)
241 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/dce.c
242 fwtk.o: $(authdir)/fwtk.c $(AUTHDEP)
243 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/fwtk.c
244 kerb4.o: $(authdir)/kerb4.c $(AUTHDEP)
245 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb4.c
246 kerb5.o: $(authdir)/kerb5.c $(AUTHDEP)
247 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb5.c
248 pam.o: $(authdir)/pam.c $(AUTHDEP)
249 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/pam.c
250 passwd.o: $(authdir)/passwd.c $(AUTHDEP)
251 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/passwd.c
252 rfc1938.o: $(authdir)/rfc1938.c $(AUTHDEP)
253 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/rfc1938.c
254 secureware.o: $(authdir)/secureware.c $(AUTHDEP)
255 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/secureware.c
256 securid.o: $(authdir)/securid.c $(AUTHDEP)
257 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid.c
258 sia.o: $(authdir)/sia.c $(AUTHDEP)
259 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sia.c
261 sudo.man.in: $(srcdir)/sudo.pod
263 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; pod2man --quotes=none --date="`date '+%B %e, %Y'`" --section=$$mansectsu --release=$(VERSION) --center="MAINTENANCE COMMANDS" sudo.pod | sed -e "s/(5)/($$mansectform)/" -e "s/(8)/($$mansectsu)/" > $@ )
265 sudo.man: sudo.man.in
266 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
270 visudo.man.in: $(srcdir)/visudo.pod
272 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; pod2man --quotes=none --date="`date '+%B %e, %Y'`" --section=$$mansectsu --release=$(VERSION) --center="MAINTENANCE COMMANDS" visudo.pod | sed -e "s/(5)/($$mansectform)/" -e "s/(8)/($$mansectsu)/" > $@ )
274 visudo.man: visudo.man.in
275 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
277 visudo.cat: visudo.man
279 sudoers.man.in: $(srcdir)/sudoers.pod
281 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; pod2man --quotes=none --date="`date '+%B %e, %Y'`" --section=$$mansectform --release=$(VERSION) --center="MAINTENANCE COMMANDS" sudoers.pod | sed -e "s/(5)/($$mansectform)/" -e "s/(8)/($$mansectsu)/" > $@ )
283 sudoers.man:: sudoers.man.in
284 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
286 sudoers.cat: sudoers.man
288 install: install-dirs install-binaries install-sudoers install-man
291 $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(sudodir) \
292 $(DESTDIR)$(visudodir) $(DESTDIR)$(sudoersdir) \
293 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform)
295 install-binaries: $(PROGS)
296 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 4111 -s sudo $(DESTDIR)$(sudodir)/sudo
297 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 -s visudo $(DESTDIR)$(visudodir)/visudo
300 test -f $(DESTDIR)$(sudoersdir)/sudoers || \
301 $(INSTALL) -O $(sudoers_uid) -G $(sudoers_gid) -M $(sudoers_mode) \
302 $(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers
305 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
306 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
307 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
311 @echo nothing to check
320 -rm -f *.o $(PROGS) testsudoers core sudo.core visudo.core \
326 -rm -f Makefile *.man pathnames.h config.h config.status config.cache \
327 config.log $(PARSESRCS)
337 rm -f ../sudo-$(VERSION).tar.gz
338 ( cd .. ; TF="/tmp/sudo.dist$$$$" ; rm -f $$TF ; for i in $(DISTFILES) ; \
339 do echo sudo-$(VERSION)/$$i >> $$TF ; done ; \
340 tar Ocf sudo-$(VERSION).tar \
341 `cat $$TF` && gzip --best sudo-$(VERSION).tar && rm -f $$TF)
342 ls -l ../sudo-$(VERSION).tar.gz
346 @mkdir tmp.`arch -l`/sudo-$(VERSION)
348 tdir=tmp.`arch -l`/sudo-$(VERSION) ; \
349 for i in $(BINFILES) ; do \
350 if [ -f $$i ]; then \
352 elif [ -f $(srcdir)/$$i ]; then \
353 cp $(srcdir)/$$i $$tdir ; \
355 echo cannot find $$i ; \
359 cp $(srcdir)/INSTALL.binary $$tdir/INSTALL ; \
360 sed -e 's/@_MANTYPE@/$(mantype)/g' -e 's/@_mansectsu@/$(mansectsu)/g' \
361 -e 's/@_mansectform@/$(mansectform)/g' $(srcdir)/Makefile.binary \
362 > $$tdir/Makefile ; \
366 ( cd tmp.`arch -l` && tar Ocf ../sudo-$(VERSION)-`arch -l`.tar sudo-$(VERSION) )
367 gzip --best sudo-$(VERSION)-`arch -l`.tar