2 # Copyright (c) 1996, 1998-2007 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.246.2.32 2008/06/22 20:29:03 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@ @GETGROUPS_LIB@ $(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 noexecfile = @NOEXECFILE@
66 noexecdir = @NOEXECDIR@
67 libexecdir = @libexecdir@
68 datarootdir = @datarootdir@
70 # Directory in which to install sudo.
73 # Directory in which to install visudo
74 visudodir = $(sbindir)
76 # Directory in which to install the sudoers file
77 sudoersdir = $(sysconfdir)
79 # Directory in which to install the man page
81 mansectsu = @mansectsu@
82 mansectform = @mansectform@
83 mandirsu = $(mandir)/$(mantype)$(mansectsu)
84 mandirform = $(mandir)/$(mantype)$(mansectform)
86 # User and group ids the installed files should be "owned" by
90 # User, group, and mode the sudoers file should be "owned" by (configure)
91 sudoers_uid = @SUDOERS_UID@
92 sudoers_gid = @SUDOERS_GID@
93 sudoers_mode = @SUDOERS_MODE@
95 # Pass in paths and uid/gid + OS dependent defined
96 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)
98 #### End of system configuration section. ####
104 SRCS = alloc.c alloca.c check.c closefrom.c def_data.c defaults.c env.c err.c \
105 fileops.c find_path.c fnmatch.c getcwd.c getprogname.c getspwuid.c \
106 gettime.c glob.c goodpath.c interfaces.c ldap.c lex.yy.c lsearch.c \
107 logging.c memrchr.c mkstemp.c parse.c parse.lex parse.yacc set_perms.c \
108 sigaction.c snprintf.c strcasecmp.c strerror.c strlcat.c strlcpy.c \
109 sudo.c sudo_noexec.c sudo.tab.c sudo_edit.c testsudoers.c tgetpass.c \
110 utimes.c visudo.c zero_bytes.c selinux.c sesh.c $(AUTH_SRCS)
112 AUTH_SRCS = auth/afs.c auth/aix_auth.c auth/bsdauth.c auth/dce.c auth/fwtk.c \
113 auth/kerb4.c auth/kerb5.c auth/pam.c auth/passwd.c auth/rfc1938.c \
114 auth/secureware.c auth/securid.c auth/securid5.c auth/sia.c \
117 HDRS = compat.h def_data.h defaults.h ins_2001.h ins_classic.h ins_csops.h \
118 ins_goons.h insults.h interfaces.h logging.h parse.h sudo.h sudo.tab.h \
119 version.h auth/sudo_auth.h emul/err.h emul/fnmatch.h emul/search.h \
120 emul/utime.h emul/glob.h emul/timespec.h
122 AUTH_OBJS = sudo_auth.o @AUTH_OBJS@
124 PARSEOBJS = sudo.tab.o lex.yy.o alloc.o defaults.o
126 SUDOBJS = check.o env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o \
127 interfaces.o logging.o parse.o set_perms.o sudo.o sudo_edit.o \
128 tgetpass.o zero_bytes.o @SUDO_OBJS@ $(AUTH_OBJS) $(PARSEOBJS)
130 VISUDOBJS = visudo.o fileops.o gettime.o goodpath.o find_path.o $(PARSEOBJS)
132 TESTOBJS = interfaces.o testsudoers.o $(PARSEOBJS)
134 LIBOBJS = @LIBOBJS@ @ALLOCA@
138 DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES HISTORY INSTALL INSTALL.configure \
139 LICENSE Makefile.in PORTING README README.LDAP \
140 TROUBLESHOOTING UPGRADE aclocal.m4 acsite.m4 aixcrypt.exp \
141 config.guess config.h.in config.sub configure configure.in \
142 def_data.in fnmatch.3 indent.pro install-sh ltmain.sh \
143 mkdefaults mkinstalldirs pathnames.h.in sample.pam \
144 sample.syslog.conf sample.sudoers schema.OpenLDAP \
145 schema.iPlanet sudo.cat sudo.man.in sudo.pod sudoers \
146 sudoers.cat sudoers.man.in sudoers.pod sudoers2ldif \
147 visudo.cat visudo.man.in visudo.pod auth/API
149 BINFILES= BUGS CHANGES HISTORY LICENSE README TROUBLESHOOTING \
150 UPGRADE install-sh mkinstalldirs sample.syslog.conf sample.sudoers \
151 sudo sudo.cat sudo.man sudo.pod sudoers sudoers.cat sudoers.man \
152 sudoers.pod visudo visudo.cat visudo.man visudo.pod
154 BINSPECIAL= INSTALL.binary Makefile.binary libtool
156 SUDODEP = $(srcdir)/sudo.h $(srcdir)/compat.h $(srcdir)/defaults.h \
157 $(srcdir)/logging.h config.h def_data.h pathnames.h
159 AUTHDEP = $(SUDODEP) $(authdir)/sudo_auth.h
161 INSDEP = $(srcdir)/ins_2001.h $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \
162 $(srcdir)/ins_goons.h $(srcdir)/insults.h
166 .SUFFIXES: .o .c .h .lex .yacc .man .cat .lo
169 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<
172 $(LIBTOOL) --mode=compile $(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 sudo_noexec.lo: $(srcdir)/sudo_noexec.c
188 $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(srcdir)/sudo_noexec.c
190 sudo_noexec.la: sudo_noexec.lo
191 $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)
193 # Uncomment the following if you want "make distclean" to clean the parser
194 @DEV@PARSESRCS = sudo.tab.h sudo.tab.c lex.yy.c def_data.c def_data.h
196 # Uncomment the following if you intend to modify parse.yacc
197 @DEV@sudo.tab.c sudo.tab.h: parse.yacc
198 @DEV@ rm -f sudo.tab.h sudo.tab.c
199 @DEV@ $(YACC) -d -b sudo $(srcdir)/parse.yacc
201 # Uncomment the following if you intend to modify parse.lex
202 @DEV@lex.yy.c: parse.lex
204 @DEV@ $(LEX) $(srcdir)/parse.lex
206 # Uncomment the following if you intend to modify def_data.in
207 @DEV@def_data.h def_data.c: def_data.in
208 @DEV@ perl $(srcdir)/mkdefaults -o def_data $(srcdir)/def_data.in
210 # Dependencies (not counting auth functions)
211 alloc.o: alloc.c $(SUDODEP)
212 check.o: check.c $(SUDODEP)
213 closefrom.o: closefrom.c config.h
214 env.o: env.c $(SUDODEP)
215 err.o: err.c config.h compat.h emul/err.h
216 fileops.o: fileops.c $(SUDODEP)
217 find_path.o: find_path.c $(SUDODEP)
218 getprogname.o: getprogname.c config.h
219 getspwuid.o: getspwuid.c $(SUDODEP)
220 goodpath.o: goodpath.c $(SUDODEP)
221 logging.o: logging.c $(SUDODEP)
222 set_perms.o: set_perms.c $(SUDODEP)
223 tgetpass.o: tgetpass.c $(SUDODEP)
224 visudo.o: visudo.c $(SUDODEP) version.h
225 sudo.o: sudo.c $(SUDODEP) interfaces.h version.h
226 interfaces.o: interfaces.c $(SUDODEP) interfaces.h
227 testsudoers.o: testsudoers.c $(SUDODEP) parse.h interfaces.h
228 parse.o: parse.c $(SUDODEP) parse.h interfaces.h
229 lex.yy.o: lex.yy.c $(SUDODEP) parse.h sudo.tab.h
230 sudo.tab.o: sudo.tab.c $(SUDODEP) parse.h sudo.tab.c sudo.tab.h
231 defaults.o: defaults.c $(SUDODEP) def_data.c auth/sudo_auth.h
232 fnmatch.o: fnmatch.c config.h compat.h emul/fnmatch.h
233 getcwd.o: getcwd.c config.h compat.h
234 glob.o: glob.c config.h compat.h emul/glob.h
235 lsearch.o: lsearch.c config.h compat.h emul/search.h
236 memrchr.o: memrchr.c config.h compat.h
237 mkstemp.o: mkstemp.c config.h compat.h
238 selinux.o: selinux.c $(SUDODEP)
239 snprintf.o: snprintf.c config.h compat.h
240 strcasecmp.o: strcasecmp.c config.h
241 strlcat.o: strlcat.c config.h
242 strlcpy.o: strlcpy.c config.h
243 strerror.o: strerror.c config.h
244 utime.o: utime.c config.h pathnames.h compat.h emul/utime.h
245 ldap.o: ldap.c $(SUDODEP) parse.h
246 sudo_edit.o: sudo_edit.c $(SUDODEP)
248 # Authentication functions live in "auth" dir and so need extra care
249 sudo_auth.o: $(authdir)/sudo_auth.c $(AUTHDEP) $(INSDEP)
250 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sudo_auth.c
251 afs.o: $(authdir)/afs.c $(AUTHDEP)
252 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/afs.c
253 aix_auth.o: $(authdir)/aix_auth.c $(AUTHDEP)
254 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/aix_auth.c
255 bsdauth.o: $(authdir)/bsdauth.c $(AUTHDEP)
256 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/bsdauth.c
257 dce.o: $(authdir)/dce.c $(AUTHDEP)
258 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/dce.c
259 fwtk.o: $(authdir)/fwtk.c $(AUTHDEP)
260 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/fwtk.c
261 kerb4.o: $(authdir)/kerb4.c $(AUTHDEP)
262 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb4.c
263 kerb5.o: $(authdir)/kerb5.c $(AUTHDEP)
264 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb5.c
265 pam.o: $(authdir)/pam.c $(AUTHDEP)
266 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/pam.c
267 passwd.o: $(authdir)/passwd.c $(AUTHDEP)
268 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/passwd.c
269 rfc1938.o: $(authdir)/rfc1938.c $(AUTHDEP)
270 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/rfc1938.c
271 secureware.o: $(authdir)/secureware.c $(AUTHDEP)
272 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/secureware.c
273 securid.o: $(authdir)/securid.c $(AUTHDEP)
274 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid.c
275 securid5.o: $(authdir)/securid5.c $(AUTHDEP)
276 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid5.c
277 sia.o: $(authdir)/sia.c $(AUTHDEP)
278 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sia.c
280 sudo.man.in: $(srcdir)/sudo.pod
282 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -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)/" | perl -p sudo.man.pl >> $@ )
284 sudo.man: sudo.man.in
285 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
289 visudo.man.in: $(srcdir)/visudo.pod
291 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -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)/" >> $@ )
293 visudo.man: visudo.man.in
294 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
296 visudo.cat: visudo.man
298 sudoers.man.in: $(srcdir)/sudoers.pod
300 ( cd $(srcdir); mansectsu=`echo @MANSECTSU@|tr A-Z a-z`; mansectform=`echo @MANSECTFORM@|tr A-Z a-z`; sed -n -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)/" | perl -p sudoers.man.pl >> $@ )
302 sudoers.man:: sudoers.man.in
303 CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status
305 sudoers.cat: sudoers.man
307 install: install-dirs install-binaries @INSTALL_NOEXEC@ install-sudoers install-man
310 $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(sudodir) \
311 $(DESTDIR)$(visudodir) $(DESTDIR)$(sudoersdir) \
312 $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform) \
313 $(DESTDIR)$(noexecdir)
315 install-binaries: $(PROGS)
316 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 4111 -s sudo $(DESTDIR)$(sudodir)/sudo
317 rm -f $(DESTDIR)$(sudodir)/sudoedit
318 ln $(DESTDIR)$(sudodir)/sudo $(DESTDIR)$(sudodir)/sudoedit
319 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 -s visudo $(DESTDIR)$(visudodir)/visudo
320 @SELINUX@ $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 -s sesh $(DESTDIR)$(libexecdir)/sesh
322 install-noexec: sudo_noexec.la
323 test -f .libs/$(noexecfile) && $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0755 .libs/$(noexecfile) $(DESTDIR)$(noexecdir)
326 test -f $(DESTDIR)$(sudoersdir)/sudoers || \
327 $(INSTALL) -O $(sudoers_uid) -G $(sudoers_gid) -M $(sudoers_mode) \
328 $(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers
331 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
332 @rm -f $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
333 ln $(DESTDIR)$(mandirsu)/sudo.$(mansectsu) $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
334 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
335 $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
339 @echo nothing to check
348 -rm -f *.o $(PROGS) testsudoers core sudo.core visudo.core \
354 -rm -rf Makefile pathnames.h config.h config.status config.cache \
355 config.log libtool sudo_noexec.lo .libs $(PARSESRCS) \
356 sudo.man sudoers.man visudo.man
366 rm -f ../sudo-$(VERSION).tar.gz
367 ( cd .. ; TF="/tmp/sudo.dist$$$$" ; rm -f $$TF ; for i in $(DISTFILES) ; \
368 do echo sudo-$(VERSION)/$$i >> $$TF ; done ; \
369 tar Ocf sudo-$(VERSION).tar \
370 `cat $$TF` && gzip --best sudo-$(VERSION).tar && rm -f $$TF)
371 ls -l ../sudo-$(VERSION).tar.gz
375 ARCH=`uname -m|sed 's:/:_:g'`+`uname -sr|sed 's/ /_/g'` ; \
377 tdir=tmp.$$ARCH/sudo-$(VERSION) ; \
379 for i in $(BINFILES) ; do \
380 if [ -f $$i ]; then \
382 elif [ -f $(srcdir)/$$i ]; then \
383 cp $(srcdir)/$$i $$tdir ; \
385 echo cannot find $$i ; \
389 if [ -f sudo_noexec.la ]; then \
390 cp libtool $$tdir ; \
391 $(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la `pwd`/$$tdir ; \
392 ln $$tdir/sudo_noexec.la $$tdir/sudo_noexec.lai ; \
393 ln -s . $$tdir/.libs ; \
395 cp $(srcdir)/INSTALL.binary $$tdir/INSTALL ; \
396 sh ./config.status --file=Makefile.binary && cp Makefile.binary $$tdir/Makefile ; \
399 cd tmp.$$ARCH && tar Ocf ../sudo-$(VERSION)-$$ARCH.tar sudo-$(VERSION) && cd .. ; \
400 gzip --best sudo-$(VERSION)-$$ARCH.tar ; \
401 rm -rf tmp.$$ARCH ; \