summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 9ec54ffb54d3f4380fe055f01b06db581b29c346 (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
#*
#* CU sudo version 1.3.1 (based on Root Group sudo version 1.1)
#*
#* This software comes with no waranty whatsoever, use at your own risk.
#*
#* Please send bugs, changes, problems to sudo-bugs@cs.colorado.edu
#*

#*  sudo version 1.1 allows users to execute commands as root
#*  Copyright (C) 1991  The Root Group, Inc.
#*
#*  This program is free software; you can redistribute it and/or modify
#*  it under the terms of the GNU General Public License as published by
#*  the Free Software Foundation; either version 1, or (at your option)
#*  any later version.
#*
#*  This program is distributed in the hope that it will be useful,
#*  but WITHOUT ANY WARRANTY; without even the implied warranty of
#*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#*  GNU General Public License for more details.
#*
#*  You should have received a copy of the GNU General Public License
#*  along with this program; if not, write to the Free Software
#*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#*
#* @configure_input@
#*

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

srcdir = @srcdir@
VPATH = @srcdir@

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

# Which install program?
INSTALL = @INSTALL@

# Libraries
LIBS = @LIBS@ @LEXLIB@

# OS defines
OSDEFS = @OSDEFS@

# Usually -g or -O
CFLAGS = -O @INC_FLAGS@

# How to make a static binary
LDFLAGS = @STATIC_FLAGS@

# Where to install things...
prefix = /usr/local
exec_prefix = $(prefix)
man_prefix = @MAN_PREFIX@

# Directory in which to install sudo.
sudodir = $(exec_prefix)/bin

# Directory in which to install visudo
visudodir = $(exec_prefix)/etc

# Directory in which to install the sudoers file
sudoersdir = /etc

# Directory in which to install the man page
mantype = @MANTYPE@
mansect = 8
mandir = $(man_prefix)/$(mantype)$(mansect)

# User and Group the installed file should be owned by
owner = root
group = staff

# See sudo.h for a list of options
OPTIONS = @OPTIONS@

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

SHELL = /bin/sh

PROGS = @PROGS@

SRCS = check.c find_path.c logging.c parse.c sudo.c sudo_goodpath.c \
       sudo_setenv.c parse.yacc parse.lex visudo.c

PARSEOBJS = y.tab.o lex.yy.o

SUDOBJS = check.o find_path.o logging.o parse.o sudo.o sudo_goodpath.o \
          sudo_setenv.o

VISUDOBJS = visudo.o

LIBOBJS = @TGETPASS@ @LIBOBJS@

HDRS = sudo.h pathnames.h options.h compat.h version.h insults.h

VERSION = 1.3.1pl5b2

DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES COPYING HISTORY INSTALL OPTIONS TODO \
            PORTING README RUNSON TROUBLESHOOTING Makefile.in acsite.m4 \
            aixcrypt.exp config.h.in configure configure.in getcwd.c strdup.c \
            indent.pro install-sh lsearch.c putenv.c tgetpass.c search.h \
            sudoers sample.sudoers sudo.cat sudo.man visudo.cat visudo.man

all: $(PROGS)

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

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

.man.cat:
	$(NROFF) -man $< > $@

sudo: $(PARSEOBJS) $(SUDOBJS) $(LIBOBJS)
	$(CC) -o $@ $(PARSEOBJS) $(SUDOBJS) $(LIBOBJS) $(LDFLAGS) $(LIBS)

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

y.tab.o: $(HDRS) y.tab.c

y.tab.c y.tab.h: parse.yacc
	$(YACC) -d parse.yacc

lex.yy.o: lex.yy.c y.tab.h $(HDRS)

lex.yy.c: parse.lex
	$(LEX) parse.lex

$(OBJS) $(LIBOBJS) : $(HDRS) config.h

sudo.cat: sudo.man

visudo.cat: visudo.man

install: install-binaries install-sudoers install-man

install-binaries: $(PROGS)
	$(INSTALL) -o $(owner) -g $(group) -m 4111 -s sudo $(sudodir)/sudo
	$(INSTALL) -o $(owner) -g $(group) -m 0111 -s visudo $(visudodir)/visudo

install-sudoers:
	@ if [ -f $(sudoersdir)/sudoers ]; then  \
	    echo "Will not overwrite existing $(sudoersdir)/sudoers file."; \
	else \
	    $(INSTALL) -o $(owner) -g $(group) -m 0400 sudoers $(sudoersdir)/sudoers; \
	fi

install-man:
	$(INSTALL) -o $(owner) -g $(group) -m 0644 sudo.$(mantype) $(mandir)/sudo.$(mansect)
	$(INSTALL) -o $(owner) -g $(group) -m 0644 visudo.$(mantype) $(mandir)/visudo.$(mansect)
	@MAN_POSTINSTALL@

tags: $(SRCS)
	ctags $(SRCS)

TAGS: $(SRCS)
	etags $(SRCS)

clean:
	-rm -f lex.yy.* y.tab.* *.o $(PROGS) core

mostlyclean: clean

distclean: clean
	rm -f Makefile config.h config.status config.cache config.log

realclean: distclean
	rm -f TAGS tags

dist: $(DISTFILES)
	rm -f ../cu-sudo.v$(VERSION).tar.Z
	( cd .. ; TF="/tmp/sudo.dist$$" ; rm -f $$TF ; for i in $(DISTFILES) ; \
	  do echo sudo.v$(VERSION)/$$i >> $$TF ; done ; \
	  tar cf cu-sudo.v$(VERSION).tar \
	  `cat $$TF` && compress cu-sudo.v$(VERSION).tar )
	ls -l ../cu-sudo.v$(VERSION).tar.Z