GNUmakefile.in 3.52 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 B. Stoller's avatar
Leigh B. Stoller committed
23

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

30
include $(OBJDIR)/Makeconf
31

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

38
include $(TESTBED_SRCDIR)/GNUmakerules
Leigh B. Stoller's avatar
Leigh B. Stoller committed
39

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

46 47 48 49 50 51
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
52

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

60
LFLAGS	=  ${TESTBED_LIBOBJDIR}/libtb/libtb.a
61

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

66
CFLAGS  += -DEVENTSYS
67 68
LFLAGS  += $(TESTBED_LIBOBJDIR)/event/libevent.a
LFLAGS  += -L/usr/local/lib -lpubsub -lcrypto
69
endif
Leigh B. Stoller's avatar
Leigh B. Stoller committed
70

71 72
bootinfo: main.o bootinfo.o bootinfo.h bootinfo_version.o \
		bootwhat.h $(BI_DBOBJ)
73
	cc $(CFLAGS) $(DBFLAG) $(INCS) \
74
		-o bootinfo main.o bootinfo.o bootinfo_version.o $(BI_DBOBJ) \
75 76 77
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

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

82
bootinfoclient: bootinfoclient.o bootinfo.h bootinfo_version.o bootwhat.h
83
	cc $(LDSTATIC) $(CFLAGS) $(DBFLAG) $(INCS) \
84 85
		-o bootinfoclient bootinfoclient.o bootinfo_version.o

86
bootinfo_mysql.o:	bootinfo.h bootwhat.h
87
main.o:			bootinfo.h bootwhat.h
88

89 90 91
testbootinfo_mysql: bootinfo_mysql.c
	cc $(CFLAGS) -DUSE_MYSQL_DB -DTEST $(INCS) \
		-o testmysql $< \
92 93
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient

94 95 96
testbootinfo_cfile: bootinfo_cfile.c
	cc $(CFLAGS) -DUSE_CFILE_DB -DTEST $(INCS) -o testcfile $< $(LFLAGS)

97 98 99 100
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 B. Stoller's avatar
Leigh B. Stoller committed
101
install:	all
102

103
install:	$(INSTALL_SBINDIR)/bootinfo \
104
		$(INSTALL_SBINDIR)/bootinfo.restart \
105
		$(INSTALL_SBINDIR)/bootinfosend \
106
		$(INSTALL_ETCDIR)/bootinfo.conf
Leigh B. Stoller's avatar
Leigh B. Stoller committed
107

108 109 110
client-install: bootinfoclient
	$(INSTALL_PROGRAM) bootinfoclient $(DESTDIR)$(CLIENT_BINDIR)

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