2 # Copyright (c) 1996, 1998-2004 Todd C. Miller <Todd.Miller@courtesan.com>
4 # Permission to use, copy, modify, and distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
8 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 # Sponsored in part by the Defense Advanced Research Projects
18 # Agency (DARPA) and Air Force Research Laboratory, Air Force
19 # Materiel Command, USAF, under agreement number F39502-99-1-0512.
23 # $Sudo: Makefile.in,v 1.253 2004/09/15 20:11:22 millert Exp $
26 #### Start of system configuration section. ####
29 authdir = $(srcdir)/auth
33 # Compiler & tools to use
40 # Our install program supports extra flags...
41 INSTALL = $(SHELL) $(srcdir)/install-sh -c
46 SUDO_LIBS = @SUDO_LIBS@ @AFS_LIBS@ $(LIBS) $(NET_LIBS)
48 # C preprocessor flags
49 CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
51 # Usually -O and/or -g
54 # Flags to pass to the link stage
56 SUDO_LDFLAGS = @SUDO_LDFLAGS@ $(LDFLAGS)
58 # Where to install things...
60 exec_prefix = @exec_prefix@
63 sysconfdir = @sysconfdir@
65 noexecdir = @NOEXECDIR@
67 # Directory in which to install sudo.
70 # Directory in which to install visudo
71 visudodir = $(sbindir)
73 # Directory in which to install the sudoers file
74 sudoersdir = $(sysconfdir)
76 # Directory in which to install the man page
78 mansectsu = @mansectsu@
79 mansectform = @mansectform@
80 mandirsu = $(mandir)/$(mantype)$(mansectsu)
81 mandirform = $(mandir)/$(mantype)$(mansectform)
83 # User and group ids the installed files should be "owned" by
87 # User, group, and mode the sudoers file should be "owned" by (configure)
88 sudoers_uid = @SUDOERS_UID@
89 sudoers_gid = @SUDOERS_GID@
90 sudoers_mode = @SUDOERS_MODE@
92 # Pass in paths and uid/gid + OS dependent defined
93 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)
95 #### End of system configuration section. ####
101 SRCS = alloc.c alloca.c check.c closefrom.c def_data.c defaults.c env.c err.c \
102 fileops.c find_path.c fnmatch.c getcwd.c getprogname.c getspwuid.c \
103 gettime.c goodpath.c interfaces.c ldap.c lex.yy.c lsearch.c logging.c \
104 parse.c parse.lex parse.yacc set_perms.c sigaction.c snprintf.c \
105 strcasecmp.c strerror.c strlcat.c strlcpy.c sudo.c sudo_noexec.c \
106 sudo.tab.c sudo_edit.c testsudoers.c tgetpass.c utimes.c visudo.c \
107 zero_bytes.c $(AUTH_SRCS)
109 AUTH_SRCS = auth/afs.c auth/aix_auth.c auth/bsdauth.c auth/dce.c auth/fwtk.c \
110 auth/kerb4.c auth/kerb5.c auth/pam.c auth/passwd.c auth/rfc1938.c \
111 auth/secureware.c auth/securid.c auth/securid5.c auth/sia.c \
114 HDRS = compat.h def_data.h defaults.h ins_2001.h ins_classic.h ins_csops.h \
115 ins_goons.h insults.h interfaces.h logging.h parse.h sudo.h sudo.tab.h \
116 version.h auth/sudo_auth.h emul/err.h emul/fnmatch.h emul/search.h \
119 AUTH_OBJS = sudo_auth.o @AUTH_OBJS@
121 PARSEOBJS = sudo.tab.o lex.yy.o alloc.o defaults.o
123 SUDOBJS = check.o env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o \
124 interfaces.o logging.o parse.o set_perms.o sudo.o sudo_edit.o \
125 tgetpass.o zero_bytes.o @SUDO_OBJS@ $(AUTH_OBJS) $(PARSEOBJS)
127 VISUDOBJS = visudo.o fileops.o gettime.o goodpath.o find_path.o $(PARSEOBJS)
129 TESTOBJS = interfaces.o testsudoers.o $(PARSEOBJS)
131 LIBOBJS = @LIBOBJS@ @ALLOCA@
135 DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES HISTORY INSTALL INSTALL.configure \
136 LICENSE Makefile.in PORTING README README.LDAP RUNSON TODO \
137 TROUBLESHOOTING UPGRADE aclocal.m4 acsite.m4 aixcrypt.exp \
138 config.guess config.h.in config.sub configure configure.in \
139 def_data.in fnmatch.3 indent.pro install-sh ltmain.sh mkdefaults \
140 mkinstalldirs pathnames.h.in sample.pam sample.syslog.conf \
141 sample.sudoers sudo.cat sudo.man.in sudo.pod sudoers sudoers.cat \
142 sudoers.man.in sudoers.pod sudoers2ldif visudo.cat visudo.man.in \
145 BINFILES= BUGS CHANGES HISTORY LICENSE README TODO TROUBLESHOOTING \
146 UPGRADE install-sh mkinstalldirs sample.syslog.conf sample.sudoers \
147 sudo sudo.cat sudo.man sudo.pod sudoers sudoers.cat sudoers.man \
148 sudoers.pod visudo visudo.cat visudo.man visudo.pod
150 BINSPECIAL= INSTALL.binary Makefile.binary libtool
152 SUDODEP = $(srcdir)/sudo.h $(srcdir)/compat.h $(srcdir)/defaults.h \
153 $(srcdir)/logging.h config.h def_data.h pathnames.h
155 AUTHDEP = $(SUDODEP) $(authdir)/sudo_auth.h
157 INSDEP = $(srcdir)/ins_2001.h $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \
158 $(srcdir)/ins_goons.h $(srcdir)/insults.h
162 .SUFFIXES: .o .c .h .lex .yacc .man .cat .lo
165 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
168 $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
172 $(NROFF) -man $< > $(srcdir)/$@
174 sudo: $(SUDOBJS) $(LIBOBJS)
175 $(CC) -o $@ $(SUDOBJS) $(LIBOBJS) $(SUDO_LDFLAGS) $(SUDO_LIBS)
177 visudo: $(VISUDOBJS) $(LIBOBJS)
178 $(CC) -o $@ $(VISUDOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)
180 testsudoers: $(TESTOBJS) $(LIBOBJS)
181 $(CC) -o $@ $(TESTOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)
183 sudo_noexec.la: sudo_noexec.lo
184 $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)
186 # Uncomment the following if you want "make distclean" to clean the parser
187 @DEV@PARSESRCS = sudo.tab.h sudo.tab.c lex.yy.c def_data.c def_data.h
189 # Uncomment the following if you intend to modify parse.yacc
190 sudo.tab.c sudo.tab.h: parse.yacc
191 rm -f sudo.tab.h sudo.tab.c
192 $(YACC) -d -b sudo $(srcdir)/parse.yacc
194 # Uncomment the following if you intend to modify parse.lex
195 @DEV@lex.yy.c: parse.lex
197 @DEV@ $(LEX) $(srcdir)/parse.lex
199 # Uncomment the following if you intend to modify def_data.in
200 @DEV@def_data.h def_data.c: def_data.in
201 @DEV@ perl $(srcdir)/mkdefaults -o def_data $(srcdir)/def_data.in
203 # Dependencies (not counting auth functions)
204 alloc.o: alloc.c $(SUDODEP)
205 check.o: check.c $(SUDODEP)
206 closefrom.o: closefrom.c config.h
207 env.o: env.c $(SUDODEP)
208 err.o: err.c config.h compat.h emul/err.h
209 fileops.o: fileops.c $(SUDODEP)
210 find_path.o: find_path.c $(SUDODEP)
211 getprogname.o: getprogname.c config.h
212 getspwuid.o: getspwuid.c $(SUDODEP)
213 goodpath.o: goodpath.c $(SUDODEP)
214 logging.o: logging.c $(SUDODEP)
215 set_perms.o: set_perms.c $(SUDODEP)
216 tgetpass.o: tgetpass.c $(SUDODEP)
217 visudo.o: visudo.c $(SUDODEP) version.h
218 sudo.o: sudo.c $(SUDODEP) interfaces.h version.h
219 interfaces.o: interfaces.c $(SUDODEP) interfaces.h
220 testsudoers.o: testsudoers.c $(SUDODEP) parse.h interfaces.h
221 parse.o: parse.c $(SUDODEP) parse.h interfaces.h
222 lex.yy.o: lex.yy.c $(SUDODEP) parse.h sudo.tab.h
223 sudo.tab.o: sudo.tab.c $(SUDODEP) parse.h sudo.tab.c sudo.tab.h
224 defaults.o: defaults.c $(SUDODEP) def_data.c auth/sudo_auth.h
225 fnmatch.o: fnmatch.c config.h compat.h emul/fnmatch.h
226 getcwd.o: getcwd.c config.h compat.h
227 lsearch.o: lsearch.c config.h compat.h emul/search.h
228 snprintf.o: snprintf.c config.h compat.h
229 strcasecmp.o: strcasecmp.c config.h
230 strlcat.o: strlcat.c config.h
231 strlcpy.o: strlcpy.c config.h
232 strerror.o: strerror.c config.h
233 utime.o: utime.c config.h pathnames.h compat.h emul/utime.h
234 ldap.o: ldap.c $(SUDODEP) parse.h
236 # Authentication functions live in "auth" dir and so need extra care
237 sudo_auth.o: $(authdir)/sudo_auth.c $(AUTHDEP) $(INSDEP)
238 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sudo_auth.c
239 afs.o: $(authdir)/afs.c $(AUTHDEP)
240 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/afs.c
241 aix_auth.o: $(authdir)/aix_auth.c $(AUTHDEP)
242 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/aix_auth.c
243 bsdauth.o: $(authdir)/bsdauth.c $(AUTHDEP)
244 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/bsdauth.c
245 dce.o: $(authdir)/dce.c $(AUTHDEP)
246 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/dce.c
247 fwtk.o: $(authdir)/fwtk.c $(AUTHDEP)
248 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/fwtk.c
249 kerb4.o: $(authdir)/kerb4.c $(AUTHDEP)
250 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb4.c
251 kerb5.o: $(authdir)/kerb5.c $(AUTHDEP)
252 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb5.c
253 pam.o: $(authdir)/pam.c $(AUTHDEP)
254 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/pam.c
255 passwd.o: $(authdir)/passwd.c $(AUTHDEP)
256 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/passwd.c
257 rfc1938.o: $(authdir)/rfc1938.c $(AUTHDEP)
258 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/rfc1938.c
259 secureware.o: $(authdir)/secureware.c $(AUTHDEP)
260 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/secureware.c
261 securid.o: $(authdir)/securid.c $(AUTHDEP)
262 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid.c
263 securid5.o: $(authdir)/securid5.c $(AUTHDEP)
264 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid5.c
265 sia.o: $(authdir)/sia.c $(AUTHDEP)
266 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sia.c
268 sudo.man.in: $(srcdir)/sudo.pod
270 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -e 1d -e '/^=pod/q' -e 's/^/.\\" /p' sudo.pod > $@; 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)/" >> $@ )
272 sudo.man: sudo.man.in
273 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
277 visudo.man.in: $(srcdir)/visudo.pod
279 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -e 1d -e '/^=pod/q' -e 's/^/.\\" /p' visudo.pod > $@; 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)/" >> $@ )
281 visudo.man: visudo.man.in
282 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
284 visudo.cat: visudo.man
286 sudoers.man.in: $(srcdir)/sudoers.pod
288 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -e 1d -e '/^=pod/q' -e 's/^/.\\" /p' sudoers.pod > $@; 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)/" >> $@ )
290 sudoers.man:: sudoers.man.in
291 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
293 sudoers.cat: sudoers.man
295 install: install-dirs install-binaries @INSTALL_NOEXEC@ install-sudoers install-man
298 $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(sudodir) \
299 $(DESTDIR)$(visudodir) $(DESTDIR)$(sudoersdir) \
300 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform) \
301 $(DESTDIR)$(noexecdir)
303 install-binaries: $(PROGS)
304 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 4111 -s sudo $(DESTDIR)$(sudodir)/sudo
305 rm -f $(DESTDIR)$(sudodir)/sudoedit
306 ln $(DESTDIR)$(sudodir)/sudo $(DESTDIR)$(sudodir)/sudoedit
308 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 -s visudo $(DESTDIR)$(visudodir)/visudo
310 install-noexec: sudo_noexec.la
311 $(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la $(DESTDIR)$(noexecdir)
313 bininst-noexec: sudo_noexec.la
314 $(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la $(DESTDIR)$(noexecdir)
317 test -f $(DESTDIR)$(sudoersdir)/sudoers || \
318 $(INSTALL) -O $(sudoers_uid) -G $(sudoers_gid) -M $(sudoers_mode) \
319 $(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers
321 install-man: sudo.$(mantype) visudo.$(mantype) sudoers.$(mantype)
322 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
323 @rm -f $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
324 ln $(DESTDIR)$(mandirsu)/sudo.$(mansectsu) $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
325 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
326 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
330 @echo nothing to check
339 -rm -f *.o $(PROGS) testsudoers core sudo.core visudo.core \
345 -rm -rf Makefile pathnames.h config.h config.status config.cache \
346 config.log libtool sudo_noexec.lo .libs $(PARSESRCS) \
347 sudo.man sudoers.man visudo.man
357 rm -f ../sudo-$(VERSION).tar.gz
358 ( cd .. ; TF="/tmp/sudo.dist$$$$" ; rm -f $$TF ; for i in $(DISTFILES) ; \
359 do echo sudo-$(VERSION)/$$i >> $$TF ; done ; \
360 tar Ocf sudo-$(VERSION).tar \
361 `cat $$TF` && gzip --best sudo-$(VERSION).tar && rm -f $$TF)
362 ls -l ../sudo-$(VERSION).tar.gz
366 ARCH=`uname -m|sed 's:/:_:g'`+`uname -sr|sed 's/ /_/g'` ; \
368 tdir=tmp.$$ARCH/sudo-$(VERSION) ; \
370 for i in $(BINFILES) ; do \
371 if [ -f $$i ]; then \
373 elif [ -f $(srcdir)/$$i ]; then \
374 cp $(srcdir)/$$i $$tdir ; \
376 echo cannot find $$i ; \
380 if [ -f sudo_noexec.la ]; then \
381 cp libtool $$tdir ; \
382 $(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la `pwd`/$$tdir ; \
383 ln $$tdir/sudo_noexec.la $$tdir/sudo_noexec.lai ; \
384 ln -s . $$tdir/.libs ; \
386 cp $(srcdir)/INSTALL.binary $$tdir/INSTALL ; \
387 sh ./config.status --file=Makefile.binary && cp Makefile.binary $$tdir/Makefile ; \
390 cd tmp.$$ARCH && tar Ocf ../sudo-$(VERSION)-$$ARCH.tar sudo-$(VERSION) && cd .. ; \
391 gzip --best sudo-$(VERSION)-$$ARCH.tar ; \
392 rm -rf tmp.$$ARCH ; \