summaryrefslogtreecommitdiff
path: root/usr.bin/sudo/Makefile.in
blob: c456a75e818f4d441a0d293f4b28005b9844e0e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
#
# Copyright (c) 1996, 1998-2004 Todd C. Miller <Todd.Miller@courtesan.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Sponsored in part by the Defense Advanced Research Projects
# Agency (DARPA) and Air Force Research Laboratory, Air Force
# Materiel Command, USAF, under agreement number F39502-99-1-0512.
#
# @configure_input@
#
# $Sudo: Makefile.in,v 1.253 2004/09/15 20:11:22 millert Exp $
#

#### Start of system configuration section. ####

srcdir = @srcdir@
authdir = $(srcdir)/auth
top_builddir = .
VPATH = @srcdir@

# Compiler & tools to use
CC = @CC@
LEX = flex
YACC = @YACC@
NROFF = nroff
LIBTOOL = @LIBTOOL@

# Our install program supports extra flags...
INSTALL = $(SHELL) $(srcdir)/install-sh -c

# Libraries
LIBS = @LIBS@
NET_LIBS = @NET_LIBS@
SUDO_LIBS = @SUDO_LIBS@ @AFS_LIBS@ $(LIBS) $(NET_LIBS)

# C preprocessor flags
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@

# Usually -O and/or -g
CFLAGS = @CFLAGS@

# Flags to pass to the link stage
LDFLAGS = @LDFLAGS@
SUDO_LDFLAGS = @SUDO_LDFLAGS@ $(LDFLAGS)

# Where to install things...
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
mandir = @mandir@
noexecdir = @NOEXECDIR@

# Directory in which to install sudo.
sudodir = $(bindir)

# Directory in which to install visudo
visudodir = $(sbindir)

# Directory in which to install the sudoers file
sudoersdir = $(sysconfdir)

# Directory in which to install the man page
mantype = @MANTYPE@
mansectsu = @mansectsu@
mansectform = @mansectform@
mandirsu = $(mandir)/$(mantype)$(mansectsu)
mandirform = $(mandir)/$(mantype)$(mansectform)

# User and group ids the installed files should be "owned" by
install_uid = 0
install_gid = 0

# User, group, and mode the sudoers file should be "owned" by (configure)
sudoers_uid = @SUDOERS_UID@
sudoers_gid = @SUDOERS_GID@
sudoers_mode = @SUDOERS_MODE@

# Pass in paths and uid/gid + OS dependent defined
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)

#### End of system configuration section. ####

SHELL = /bin/sh

PROGS = @PROGS@

SRCS = alloc.c alloca.c check.c closefrom.c def_data.c defaults.c env.c err.c \
       fileops.c find_path.c fnmatch.c getcwd.c getprogname.c getspwuid.c \
       gettime.c goodpath.c interfaces.c ldap.c lex.yy.c lsearch.c logging.c \
       parse.c parse.lex parse.yacc set_perms.c sigaction.c snprintf.c \
       strcasecmp.c strerror.c strlcat.c strlcpy.c sudo.c sudo_noexec.c \
       sudo.tab.c sudo_edit.c testsudoers.c tgetpass.c utimes.c visudo.c \
       zero_bytes.c $(AUTH_SRCS)

AUTH_SRCS = auth/afs.c auth/aix_auth.c auth/bsdauth.c auth/dce.c auth/fwtk.c \
	    auth/kerb4.c auth/kerb5.c auth/pam.c auth/passwd.c auth/rfc1938.c \
	    auth/secureware.c auth/securid.c auth/securid5.c auth/sia.c \
	    auth/sudo_auth.c

HDRS = compat.h def_data.h defaults.h ins_2001.h ins_classic.h ins_csops.h \
       ins_goons.h insults.h interfaces.h logging.h parse.h sudo.h sudo.tab.h \
       version.h auth/sudo_auth.h emul/err.h emul/fnmatch.h emul/search.h \
       emul/utime.h

AUTH_OBJS = sudo_auth.o @AUTH_OBJS@

PARSEOBJS = sudo.tab.o lex.yy.o alloc.o defaults.o

SUDOBJS = check.o env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o \
	  interfaces.o logging.o parse.o set_perms.o sudo.o sudo_edit.o \
	  tgetpass.o zero_bytes.o @SUDO_OBJS@ $(AUTH_OBJS) $(PARSEOBJS)

VISUDOBJS = visudo.o fileops.o gettime.o goodpath.o find_path.o $(PARSEOBJS)

TESTOBJS = interfaces.o testsudoers.o $(PARSEOBJS)

LIBOBJS = @LIBOBJS@ @ALLOCA@

VERSION = 1.6.8p2

DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES HISTORY INSTALL INSTALL.configure \
	    LICENSE Makefile.in PORTING README README.LDAP RUNSON TODO \
	    TROUBLESHOOTING UPGRADE aclocal.m4 acsite.m4 aixcrypt.exp \
	    config.guess config.h.in config.sub configure configure.in \
	    def_data.in fnmatch.3 indent.pro install-sh ltmain.sh mkdefaults \
	    mkinstalldirs pathnames.h.in sample.pam sample.syslog.conf \
	    sample.sudoers sudo.cat sudo.man.in sudo.pod sudoers sudoers.cat \
	    sudoers.man.in sudoers.pod sudoers2ldif visudo.cat visudo.man.in \
	    visudo.pod auth/API

BINFILES= BUGS CHANGES HISTORY LICENSE README TODO TROUBLESHOOTING \
	  UPGRADE install-sh mkinstalldirs sample.syslog.conf sample.sudoers \
	  sudo sudo.cat sudo.man sudo.pod sudoers sudoers.cat sudoers.man \
	  sudoers.pod visudo visudo.cat visudo.man visudo.pod

BINSPECIAL= INSTALL.binary Makefile.binary libtool

SUDODEP = $(srcdir)/sudo.h $(srcdir)/compat.h $(srcdir)/defaults.h \
	  $(srcdir)/logging.h config.h def_data.h pathnames.h

AUTHDEP = $(SUDODEP) $(authdir)/sudo_auth.h

INSDEP = $(srcdir)/ins_2001.h $(srcdir)/ins_classic.h $(srcdir)/ins_csops.h \
	 $(srcdir)/ins_goons.h $(srcdir)/insults.h

all: $(PROGS)

.SUFFIXES: .o .c .h .lex .yacc .man .cat .lo

.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<

.c.lo:
	$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $<

.man.cat:
	@rm -f $(srcdir)/$@
	$(NROFF) -man $< > $(srcdir)/$@

sudo: $(SUDOBJS) $(LIBOBJS)
	$(CC) -o $@ $(SUDOBJS) $(LIBOBJS) $(SUDO_LDFLAGS) $(SUDO_LIBS)

visudo: $(VISUDOBJS) $(LIBOBJS)
	$(CC) -o $@ $(VISUDOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)

testsudoers: $(TESTOBJS) $(LIBOBJS)
	$(CC) -o $@ $(TESTOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS) $(NET_LIBS)

sudo_noexec.la: sudo_noexec.lo
	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)

# Uncomment the following if you want "make distclean" to clean the parser
@DEV@PARSESRCS = sudo.tab.h sudo.tab.c lex.yy.c def_data.c def_data.h

# Uncomment the following if you intend to modify parse.yacc
@DEV@sudo.tab.c sudo.tab.h: parse.yacc
@DEV@	rm -f sudo.tab.h sudo.tab.c
@DEV@	$(YACC) -d -b sudo $(srcdir)/parse.yacc

# Uncomment the following if you intend to modify parse.lex
@DEV@lex.yy.c: parse.lex
@DEV@	rm -f lex.yy.c
@DEV@	$(LEX) $(srcdir)/parse.lex

# Uncomment the following if you intend to modify def_data.in
@DEV@def_data.h def_data.c: def_data.in
@DEV@	perl $(srcdir)/mkdefaults -o def_data $(srcdir)/def_data.in

# Dependencies (not counting auth functions)
alloc.o: alloc.c $(SUDODEP)
check.o: check.c $(SUDODEP)
closefrom.o: closefrom.c config.h
env.o: env.c $(SUDODEP)
err.o: err.c config.h compat.h emul/err.h
fileops.o: fileops.c $(SUDODEP)
find_path.o: find_path.c $(SUDODEP)
getprogname.o: getprogname.c config.h
getspwuid.o: getspwuid.c $(SUDODEP)
goodpath.o: goodpath.c $(SUDODEP)
logging.o: logging.c $(SUDODEP)
set_perms.o: set_perms.c $(SUDODEP)
tgetpass.o: tgetpass.c $(SUDODEP)
visudo.o: visudo.c $(SUDODEP) version.h
sudo.o: sudo.c $(SUDODEP) interfaces.h version.h
interfaces.o: interfaces.c $(SUDODEP) interfaces.h
testsudoers.o: testsudoers.c $(SUDODEP) parse.h interfaces.h
parse.o: parse.c $(SUDODEP) parse.h interfaces.h
lex.yy.o: lex.yy.c $(SUDODEP) parse.h sudo.tab.h
sudo.tab.o: sudo.tab.c $(SUDODEP) parse.h sudo.tab.c sudo.tab.h
defaults.o: defaults.c $(SUDODEP) def_data.c auth/sudo_auth.h
fnmatch.o: fnmatch.c config.h compat.h emul/fnmatch.h
getcwd.o: getcwd.c config.h compat.h
lsearch.o: lsearch.c config.h compat.h emul/search.h
snprintf.o: snprintf.c config.h compat.h
strcasecmp.o: strcasecmp.c config.h
strlcat.o: strlcat.c config.h
strlcpy.o: strlcpy.c config.h
strerror.o: strerror.c config.h
utime.o: utime.c config.h pathnames.h compat.h emul/utime.h
ldap.o: ldap.c $(SUDODEP) parse.h

# Authentication functions live in "auth" dir and so need extra care
sudo_auth.o: $(authdir)/sudo_auth.c $(AUTHDEP) $(INSDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sudo_auth.c
afs.o: $(authdir)/afs.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/afs.c
aix_auth.o: $(authdir)/aix_auth.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/aix_auth.c
bsdauth.o: $(authdir)/bsdauth.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/bsdauth.c
dce.o: $(authdir)/dce.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/dce.c
fwtk.o: $(authdir)/fwtk.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/fwtk.c
kerb4.o: $(authdir)/kerb4.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb4.c
kerb5.o: $(authdir)/kerb5.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/kerb5.c
pam.o: $(authdir)/pam.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/pam.c
passwd.o: $(authdir)/passwd.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/passwd.c
rfc1938.o: $(authdir)/rfc1938.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/rfc1938.c
secureware.o: $(authdir)/secureware.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/secureware.c
securid.o: $(authdir)/securid.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid.c
securid5.o: $(authdir)/securid5.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/securid5.c
sia.o: $(authdir)/sia.c $(AUTHDEP)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(OPTIONS) $(authdir)/sia.c

sudo.man.in: $(srcdir)/sudo.pod
	@rm -f $(srcdir)/$@
	( 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)/" >> $@ )

sudo.man: sudo.man.in
	CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status

sudo.cat: sudo.man

visudo.man.in: $(srcdir)/visudo.pod
	@rm -f $(srcdir)/$@
	( 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)/" >> $@ )

visudo.man: visudo.man.in
	CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status

visudo.cat: visudo.man

sudoers.man.in: $(srcdir)/sudoers.pod
	@rm -f $(srcdir)/$@
	( 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)/" >> $@ )

sudoers.man:: sudoers.man.in
	CONFIG_FILES=$@ CONFIG_HEADERS= sh ./config.status

sudoers.cat: sudoers.man

install: install-dirs install-binaries @INSTALL_NOEXEC@ install-sudoers install-man

install-dirs:
	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(sudodir) \
	    $(DESTDIR)$(visudodir) $(DESTDIR)$(sudoersdir) \
	    $(DESTDIR)$(mandirsu) $(DESTDIR)$(mandirform) \
	    $(DESTDIR)$(noexecdir)

install-binaries: $(PROGS)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 4111 -s sudo $(DESTDIR)$(sudodir)/sudo
	rm -f $(DESTDIR)$(sudodir)/sudoedit
	ln $(DESTDIR)$(sudodir)/sudo $(DESTDIR)$(sudodir)/sudoedit

	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0111 -s visudo $(DESTDIR)$(visudodir)/visudo

install-noexec: sudo_noexec.la
	$(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la $(DESTDIR)$(noexecdir)

bininst-noexec: sudo_noexec.la
	$(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la $(DESTDIR)$(noexecdir)

install-sudoers:
	test -f $(DESTDIR)$(sudoersdir)/sudoers || \
	    $(INSTALL) -O $(sudoers_uid) -G $(sudoers_gid) -M $(sudoers_mode) \
		$(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers

install-man:
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
	@rm -f $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
	ln $(DESTDIR)$(mandirsu)/sudo.$(mansectsu) $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/visudo.$(mantype) $(DESTDIR)$(mandirsu)/visudo.$(mansectsu)
	$(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudoers.$(mantype) $(DESTDIR)$(mandirform)/sudoers.$(mansectform)
@MAN_POSTINSTALL@

check:
	@echo nothing to check

tags: $(SRCS)
	ctags $(SRCS)

TAGS: $(SRCS)
	etags $(SRCS)

clean:
	-rm -f *.o $(PROGS) testsudoers core sudo.core visudo.core \
	       testsudoers.core

mostlyclean: clean

distclean: clean
	-rm -rf Makefile pathnames.h config.h config.status config.cache \
		config.log libtool sudo_noexec.lo .libs $(PARSESRCS) \
		sudo.man sudoers.man visudo.man

clobber: distclean

realclean: distclean
	rm -f TAGS tags

cleandir: realclean

dist:
	rm -f ../sudo-$(VERSION).tar.gz
	( cd .. ; TF="/tmp/sudo.dist$$$$" ; rm -f $$TF ; for i in $(DISTFILES) ; \
	  do echo sudo-$(VERSION)/$$i >> $$TF ; done ; \
	  tar Ocf sudo-$(VERSION).tar \
	  `cat $$TF` && gzip --best sudo-$(VERSION).tar && rm -f $$TF)
	ls -l ../sudo-$(VERSION).tar.gz

bindist:
	( \
	  ARCH=`uname -m|sed 's:/:_:g'`+`uname -sr|sed 's/ /_/g'` ; \
	  mkdir tmp.$$ARCH ; \
	  tdir=tmp.$$ARCH/sudo-$(VERSION) ; \
	  mkdir $$tdir ; \
	  for i in $(BINFILES) ; do \
	    if [ -f $$i ]; then \
	      cp $$i $$tdir ; \
	    elif [ -f $(srcdir)/$$i ]; then \
	      cp $(srcdir)/$$i $$tdir ; \
	    else \
	      echo cannot find $$i ; \
	      exit 1 ; \
	    fi ; \
	  done ; \
	  if [ -f sudo_noexec.la ]; then \
	    cp libtool $$tdir ; \
	    $(LIBTOOL) --mode=install $(INSTALL) sudo_noexec.la `pwd`/$$tdir ; \
	    ln $$tdir/sudo_noexec.la $$tdir/sudo_noexec.lai ; \
	    ln -s . $$tdir/.libs ; \
	  fi ; \
	  cp $(srcdir)/INSTALL.binary $$tdir/INSTALL ; \
	  sh ./config.status --file=Makefile.binary && cp Makefile.binary $$tdir/Makefile ; \
	  strip sudo ; \
	  strip visudo ; \
	  cd tmp.$$ARCH && tar Ocf ../sudo-$(VERSION)-$$ARCH.tar sudo-$(VERSION) && cd .. ; \
	  gzip --best sudo-$(VERSION)-$$ARCH.tar ; \
	  rm -rf tmp.$$ARCH ; \
	)