2 # Copyright (c) 2011 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.
20 #### Start of system configuration section. ####
24 top_builddir = @top_builddir@
25 top_srcdir = @top_srcdir@
26 incdir = $(top_srcdir)/include
28 # Compiler & tools to use
30 LIBTOOL = @LIBTOOL@ @LT_STATIC@
32 # Our install program supports extra flags...
33 INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
36 LT_LIBS = $(top_builddir)/common/libcommon.la $(LIBOBJDIR)libreplace.la
37 LIBS = @LIBS@ @SUDO_LIBS@ @GETGROUPS_LIB@ @NET_LIBS@ $(LT_LIBS)
39 # C preprocessor flags
40 CPPFLAGS = -I$(incdir) -I$(top_builddir) -I$(srcdir) -I. @CPPFLAGS@
42 # Usually -O and/or -g
45 # Flags to pass to the link stage
48 # Where to install things...
50 exec_prefix = @exec_prefix@
53 sysconfdir = @sysconfdir@
54 libexecdir = @libexecdir@
55 datarootdir = @datarootdir@
56 localstatedir = @localstatedir@
57 noexecfile = @NOEXECFILE@
58 noexecdir = @NOEXECDIR@
60 # User and group ids the installed files should be "owned" by
64 # OS dependent defines
65 DEFS = @OSDEFS@ -D_PATH_SUDO_CONF=\"$(sysconfdir)/sudo.conf\"
67 #### End of system configuration section. ####
73 OBJS = conversation.o error.o exec.o exec_pty.o get_pty.o net_ifs.o \
74 load_plugins.o parse_args.o sudo.o sudo_edit.o tgetpass.o \
75 ttysize.o utmp.o @SUDO_OBJS@
77 LIBOBJDIR = $(top_builddir)/@ac_config_libobj_dir@/
79 VERSION = @PACKAGE_VERSION@
81 SUDODEP = $(srcdir)/sudo.h $(incdir)/sudo_plugin.h $(incdir)/alloc.h \
82 $(incdir)/error.h $(incdir)/list.h $(incdir)/missing.h \
83 $(top_builddir)/pathnames.h $(top_builddir)/config.h
87 Makefile: $(srcdir)/Makefile.in
88 (cd $(top_builddir) && ./config.status --file src/Makefile)
90 .SUFFIXES: .c .h .lo .o
93 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
96 $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
98 sudo: $(OBJS) $(LT_LIBS)
99 $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) -static-libtool-libs
101 libsudo_noexec.la: sudo_noexec.lo
102 $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ sudo_noexec.lo -avoid-version -rpath $(noexecdir)
108 # XXX - SUDODEP is overkill for some of these
109 conversation.o: $(srcdir)/conversation.c $(SUDODEP)
110 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/conversation.c
111 error.o: $(srcdir)/error.c $(incdir)/missing.h $(incdir)/error.h $(top_builddir)/config.h
112 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/error.c
113 exec.o: $(srcdir)/exec.c $(SUDODEP) $(srcdir)/sudo_exec.h
114 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/exec.c
115 exec_pty.o: $(srcdir)/exec_pty.c $(SUDODEP) $(srcdir)/sudo_exec.h
116 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/exec_pty.c
117 get_pty.o: $(srcdir)/get_pty.c $(SUDODEP)
118 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/get_pty.c
119 net_ifs.o: $(srcdir)/net_ifs.c $(SUDODEP)
120 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/net_ifs.c
121 load_plugins.o: $(srcdir)/load_plugins.c $(SUDODEP)
122 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/load_plugins.c
123 parse_args.o: $(srcdir)/parse_args.c sudo_usage.h $(SUDODEP)
124 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/parse_args.c
125 preload.o: $(srcdir)/preload.c $(incdir)/sudo_plugin.h $(top_builddir)/config.h
126 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/preload.c
127 selinux.o: $(srcdir)/selinux.c $(SUDODEP)
128 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/selinux.c
129 sesh.o: $(srcdir)/sesh.c $(incdir)/missing.h $(top_builddir)/config.h
130 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/sesh.c
131 sudo.o: $(srcdir)/sudo.c $(SUDODEP)
132 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/sudo.c
133 sudo_edit.o: $(srcdir)/sudo_edit.c $(SUDODEP)
134 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/sudo_edit.c
135 sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(incdir)/missing.h $(top_builddir)/config.h
136 $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/sudo_noexec.c
137 tgetpass.o: $(srcdir)/tgetpass.c $(SUDODEP)
138 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/tgetpass.c
139 ttysize.o: $(srcdir)/ttysize.c $(incdir)/missing.h $(top_builddir)/config.h
140 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/ttysize.c
141 utmp.o: $(srcdir)/utmp.c $(SUDODEP)
142 $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/utmp.c
146 install: install-dirs install-binaries @INSTALL_NOEXEC@
149 $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) \
150 $(DESTDIR)$(noexecdir)
152 install-binaries: install-dirs $(PROGS)
153 $(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 04111 sudo $(DESTDIR)$(bindir)/sudo
154 rm -f $(DESTDIR)$(bindir)/sudoedit
155 ln $(DESTDIR)$(bindir)/sudo $(DESTDIR)$(bindir)/sudoedit
156 if [ -f sesh ]; then $(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 0111 sesh $(DESTDIR)$(libexecdir)/sesh; fi
162 # We install sudo_noexec by hand so we can avoid a "lib" prefix
163 # and a version number. Since we use LD_PRELOAD, neither is needed.
164 install-noexec: install-dirs libsudo_noexec.la
165 if [ -f .libs/lib$(noexecfile) ]; then $(INSTALL) -b~ -O $(install_uid) -G $(install_gid) -M 0755 .libs/lib$(noexecfile) $(DESTDIR)$(noexecdir)/$(noexecfile); fi
170 -rm -f $(DESTDIR)$(bindir)/sudo $(DESTDIR)$(bindir)/sudoedit \
171 $(DESTDIR)$(libexecdir)/sesh \
172 $(DESTDIR)$(noexecdir)/$(noexecfile) \
177 -$(LIBTOOL) --mode=clean rm -f $(PROGS) *.lo *.o *.la *.a stamp-* core *.core core.*
182 -rm -rf Makefile .libs sudo_usage.h