GNUmakefile.in 3.51 KB
Newer Older
1
#
2
# Copyright (c) 2000-2018 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
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ..
SUBDIR		= pxe
28
EVENTSYS        = @EVENTSYS@
29 30
# This needs a rename.
BOOTINFO_PXEEVENTS = @BOOTINFO_EVENTS@
31

32
include $(OBJDIR)/Makeconf
33

34 35 36 37
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
38 39 40 41
all: bootinfo bootinfosend bootinfo.restart

# For VPATH.
MOSTLY_SRCDIRS = ${TESTBED_SRCDIR}/clientside/os/bootinfo
42

43
include $(TESTBED_SRCDIR)/GNUmakerules
Leigh Stoller's avatar
Leigh Stoller committed
44

45 46 47
DBFLAG	= -DUSE_MYSQL_DB
#DBFLAG = -DUSE_CFILE_DB
#DBFLAG = -DUSE_NULL_DB
48 49
BI_DBSRC   = bootinfo_null.c bootinfo_cfile.c bootinfo_mysql.c
BI_DBOBJ   = bootinfo_null.o bootinfo_cfile.o bootinfo_mysql.o
50

51 52 53 54 55 56
INCS    = -I${OBJDIR}
ifeq ($(EVENTSYS),1)
# XXX eventdir must be included before /usr/local/include for event.h
INCS	+= -I$(TESTBED_LIBSRCDIR)/event
endif
INCS    += -I$(TESTBED_LIBSRCDIR)/libtb -I/usr/local/include
57
INCS    += -I${TESTBED_SRCDIR}/clientside/os/bootinfo
58

59 60 61 62 63
CFLAGS	+= -Wall \
	$(INCS) $(DBFLAG) -DSOLARIS -DHAVE_SOCKADDR_SA_LEN -DUSE_RECVMSG \
	-DCONFPATH='"$(INSTALL_ETCDIR)/"' -DTBDBNAME='"$(TBDBNAME)"' \
	-DFALLBACK_HOST='"$(BOSSNODE)"' -DBOSSNODE='"$(BOSSNODE)"' \
	-DDEFAULT_PATH='"/tftpboot/pxeboot.newnode"' \
64
	-DLOG_TESTBED=$(LOG_TESTBED) -DLIBWRAP
65

66
LFLAGS	= -lwrap ${TESTBED_LIBOBJDIR}/libtb/libtb.a
67

68
ifeq ($(EVENTSYS),1)
69 70 71
BI_DBSRC += event-support.c
BI_DBOBJ += event-support.o

72
CFLAGS  += -DEVENTSYS
73 74
LFLAGS  += $(TESTBED_LIBOBJDIR)/event/libevent.a
LFLAGS  += -L/usr/local/lib -lpubsub -lcrypto
75 76 77
ifeq ($(BOOTINFO_PXEEVENTS),1)
CFLAGS  += -DBOOTINFO_PXEEVENTS
endif
78
endif
Leigh Stoller's avatar
Leigh Stoller committed
79

80 81
bootinfo: main.o bootinfo.o bootinfo.h bootinfo_version.o \
		bootwhat.h $(BI_DBOBJ)
82
	cc $(CFLAGS) $(DBFLAG) $(INCS) \
83
		-o bootinfo main.o bootinfo.o bootinfo_version.o $(BI_DBOBJ) \
84 85 86
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

bootinfosend: bootinfosend.o bootinfo.h bootinfo_version.o bootwhat.h $(BI_DBOBJ)
87
	cc $(CFLAGS) $(DBFLAG) $(INCS) \
88
		-o bootinfosend bootinfosend.o bootinfo_version.o $(BI_DBOBJ) \
89 90
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

91
bootinfo_mysql.o:	bootinfo.h bootwhat.h
92
main.o:			bootinfo.h bootwhat.h
93

94 95 96
testbootinfo_mysql: bootinfo_mysql.c
	cc $(CFLAGS) -DUSE_MYSQL_DB -DTEST $(INCS) \
		-o testmysql $< \
97 98
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

99 100 101
testbootinfo_cfile: bootinfo_cfile.c
	cc $(CFLAGS) -DUSE_CFILE_DB -DTEST $(INCS) -o testcfile $< $(LFLAGS)

102 103 104 105
bootinfo_version.c: bootinfo.c bootinfo_mysql.c
	echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"


Leigh Stoller's avatar
Leigh Stoller committed
106
install:	all
107

108
install:	$(INSTALL_SBINDIR)/bootinfo \
109
		$(INSTALL_SBINDIR)/bootinfo.restart \
110
		$(INSTALL_SBINDIR)/bootinfosend \
111
		$(INSTALL_ETCDIR)/bootinfo.conf
Leigh Stoller's avatar
Leigh Stoller committed
112

113
client-install: 
114

Leigh Stoller's avatar
Leigh Stoller committed
115
clean: 
116
	rm -f *.o core bootinfo bootinfosend testmysql bootinfo_version.c