GNUmakefile.in 2.48 KB
Newer Older
1
#
2
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file 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 Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
22
#
Leigh Stoller's avatar
Leigh Stoller committed
23

24 25 26 27 28 29
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ..
SUBDIR		= security

include $(OBJDIR)/Makeconf
30

31
BINS		= suexec runsuid
32
SBINS		= genlastlog lastlog_daemon
33

34 35
# These scripts installed setuid, with sudo. 
SETUID_BIN_SCRIPTS   = 
36 37
SETUID_SBIN_SCRIPTS  =
SETUID_LIBX_PROGS    = suexec runsuid
38
SETUID_CTRL_LIBX_PROGS = runsuid
39

40 41 42 43
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
44
all:	$(BINS) $(SBINS)
45

46
include $(TESTBED_SRCDIR)/GNUmakerules
47

48
CFLAGS	+= -O2 -g
49

50 51 52 53 54 55
suexec:		suexec.c suexec.h
	$(CC) $(CFLAGS) \
		-DLOG_EXEC='"$(prefix)/log/suexec.log"' \
		-DDOC_ROOT='"$(prefix)/libexec/"' \
		-DSAFE_PATH='"$(prefix)/libexec:/usr/local/bin:/usr/bin:/bin"'\
		-o suexec $<
56

57 58 59
runsuid:	runsuid.c ${OBJDIR}/config.h
	$(CC) $(CFLAGS) -I${OBJDIR} -o runsuid $<

60
genlastlog:	genlastlog.c
61
	$(CC) $(CFLAGS) -I/usr/local/include -I$(TESTBED_LIBSRCDIR)/libtb \
62 63 64 65
		-DTBDBNAME='"$(TBDBNAME)"' \
		-DUSERSVAR='"$(prefix)/usersvar"' \
		-DOURDOMAIN='"$(OURDOMAIN)"' \
                -DUSERNODE='"$(USERNODE)"' \
66
		-DLOG_TESTBED=$(LOG_TESTBED) \
67
		-o genlastlog $< ${TESTBED_LIBOBJDIR}/libtb/libtb.a \
68
		-L/usr/local/lib/mysql -lmysqlclient -lz
69

70
install: $(addprefix $(INSTALL_LIBEXECDIR)/, $(BINS)) \
71 72
	$(addprefix $(INSTALL_SBINDIR)/, $(SBINS)) \
	$(addprefix $(INSTALL_DIR)/opsdir/libexec/, $(SETUID_CTRL_LIBX_PROGS))
73 74

post-install:
75
	@echo "post-install no longer required"
76

77 78
control-install: \
	$(addprefix $(INSTALL_LIBEXECDIR)/, $(SETUID_CTRL_LIBX_PROGS))
79 80 81 82 83

$(INSTALL_DIR)/opsdir/libexec/runsuid: runsuid
	echo "Installing (setuid) $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/libexec
	$(SUDO) $(INSTALL) -o root -m 4755 $< $@
84

85
clean:
86
	rm -f *.o genlastlog suexec runsuid core