GNUmakefile.in 3.66 KB
Newer Older
1
#
2
# Copyright (c) 2000-2016 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
all: bootinfo bootinfosend bootinfo.restart bootinfoclient
39

40
include $(TESTBED_SRCDIR)/GNUmakerules
Leigh Stoller's avatar
Leigh Stoller committed
41

42 43 44
DBFLAG	= -DUSE_MYSQL_DB
#DBFLAG = -DUSE_CFILE_DB
#DBFLAG = -DUSE_NULL_DB
45 46
BI_DBSRC   = bootinfo_null.c bootinfo_cfile.c bootinfo_mysql.c
BI_DBOBJ   = bootinfo_null.o bootinfo_cfile.o bootinfo_mysql.o
47

48 49 50 51 52 53
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
54

55 56 57 58 59
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"' \
60
	-DLOG_TESTBED=$(LOG_TESTBED) -DLIBWRAP
61

62
LFLAGS	= -lwrap ${TESTBED_LIBOBJDIR}/libtb/libtb.a
63

64
ifeq ($(EVENTSYS),1)
65 66 67
BI_DBSRC += event-support.c
BI_DBOBJ += event-support.o

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

76 77
bootinfo: main.o bootinfo.o bootinfo.h bootinfo_version.o \
		bootwhat.h $(BI_DBOBJ)
78
	cc $(CFLAGS) $(DBFLAG) $(INCS) \
79
		-o bootinfo main.o bootinfo.o bootinfo_version.o $(BI_DBOBJ) \
80 81 82
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

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

87
bootinfoclient: bootinfoclient.o bootinfo.h bootinfo_version.o bootwhat.h
88
	cc $(LDSTATIC) $(CFLAGS) $(DBFLAG) $(INCS) \
89 90
		-o bootinfoclient bootinfoclient.o bootinfo_version.o

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 114 115
client-install: bootinfoclient
	$(INSTALL_PROGRAM) bootinfoclient $(DESTDIR)$(CLIENT_BINDIR)

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