Commit 2b89effa authored by Leigh Stoller's avatar Leigh Stoller

First round of configure changes. Lots of makefile rewriting.

parent 34f6d836
# Testbed wide makefile.
#
# Testbed Makefile
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
SUBDIRS = assign capture db discvr lib os pxe security tbsetup tip tmcd www
include Makeconf
SUBDIRS = lib assign discvr tbsetup db os security pxe tmcd www tip capture
all: all-subdirs
install: all
install: install-subdirs
echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"
post-install:
@$(MAKE) -C tbsetup post-install
@$(MAKE) -C security post-install
clean: clean-subdirs
distclean: distclean-subdirs
rm -f Makeconf GNUmakefile config.status config.cache config.log
# How to recursively descend into subdirectories to make general
# targets such as `all'.
......@@ -18,14 +27,6 @@ post-install:
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
clean:
@$(MAKE) -C assign clean
@$(MAKE) -C discvr clean
@$(MAKE) -C os clean
@$(MAKE) -C tmcd clean
@$(MAKE) -C os/imagezip clean
@$(MAKE) -C tbsetup/checkpass clean
.PHONY: post-install
# Get rid of a bunch of nasty built-in implicit rules.
......
......@@ -21,5 +21,21 @@ $(INSTALL_LIBDIR)/%: %
-mkdir -p $(INSTALL_LIBDIR)
$(INSTALL_PROGRAM) $< $@
$(INSTALL_ETCDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_ETCDIR)
$(INSTALL_DATA) $< $@
$(INSTALL_WWWDIR)/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_WWWDIR)
$(INSTALL_DATA) $< $@
CFLAGS += $(LOCALCFLAGS)
vpath %.c $(SRCDIR)
clean:
distclean: clean
rm -f GNUmakefile $(DISTCLEAN_FILES)
#
# Stick all the little piddly defs in here.
#
prefix = /usr/testbed
exec_prefix = ${prefix}
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL} -m 755
INSTALL_DATA = ${INSTALL} -m 444
INSTALL_DIR = $(exec_prefix)
INSTALL_BINDIR = $(exec_prefix)/bin
INSTALL_SBINDIR = $(exec_prefix)/sbin
INSTALL_LIBDIR = $(exec_prefix)/lib
INSTALL_WWWDIR = $(exec_prefix)/www
#
# Most of the configure-substitution magic is done here.
# All the other makefiles in the NodeOS include
# this fragment
#
export CC = @CC@
export CXX = @CXX@
export LD = @CC@ ${CFLAGS}
export STRIP = @STRIP@
export RANLIB = @RANLIB@
prefix = @prefix@
exec_prefix = @exec_prefix@
TBDBNAME = @TBDBNAME@
CPPFLAGS = @CPPFLAGS@
CFLAGS += @CFLAGS@
CXXFLAGS += @CXXFLAGS@
LDFLAGS = @LDFLAGS@
OPT_CFLAGS = @OPT_CFLAGS@
INSTALL_TOPDIR = @exec_prefix@
INSTALL_DIR = @exec_prefix@
INSTALL_LIBDIR = @libdir@
INSTALL_BINDIR = @bindir@
INSTALL_SBINDIR = @sbindir@
INSTALL_LIBEXECDIR = @libexecdir@
INSTALL_ETCDIR = @sysconfdir@
INSTALL_WWWDIR = @exec_prefix@/www
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL@ -m 755
INSTALL_DATA = @INSTALL@ -m 444
......@@ -2,11 +2,13 @@
# Insert Copyright Here.
#
include ../Makeconf
all: assign
include ../GNUmakerules
CXX=/usr/bin/g++
CC=/usr/bin/gcc
LEDA=/usr/testbed/LEDA/LEDA-4.0
LEDA=@LEDA@
OBJS=score.o parse_top.o parse_ptop.o
LIBS+=-L${LEDA} -lD3 -lW -lP -lG -lL -L/usr/X11R6/lib -lX11 -lm -L.
LDFLAGS+= -O3 -fomit-frame-pointer -m486
......@@ -16,8 +18,6 @@ CXXFLAGS += -Wall -O3 -fomit-frame-pointer -m486
#CXXFLAGS += -O0 -g -Wall -DSCORE_DEBUG -DVERBOSE -DSCORE_DEBUG_MORE
DEPLIBS=$(OBJS)
all: assign
assign: ${DEPLIBS} ${OBJS} assign.o
${CXX} assign.o -o assign ${LIBS} $(OBJS) ${LDFLAGS}
......@@ -31,4 +31,3 @@ install: $(INSTALL_BINDIR)/assign $(INSTALL_LIBDIR)/assign
clean:
/bin/rm -f *.o assign
This diff is collapsed.
This diff is collapsed.
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
include ../Makeconf
all: capture
include ../GNUmakerules
DESTDIR=
#
......@@ -6,16 +12,15 @@ DESTDIR=
#
CFLAGS= -g -O2 -DLOG_DROPS
all: capture
capture: capture.c
cc $(CFLAGS) -o capture capture.c
install: capture
#
# Do not install by default.
#
install:
real-install: all
install -s capture $(DESTDIR)/usr/site/bin
clean: FRC
clean:
rm -f *.o capture core errs Errs
FRC:
This diff is collapsed.
AC_PREREQ(2.13)
AC_INIT(Makeconf.in)
AC_CONFIG_AUX_DIR(${srcdir}/autoconf)
AC_CHECK_TOOL(CC,gcc)
AC_CHECK_TOOL(CXX,g++)
AC_CHECK_TOOL(AR,ar)
AC_CHECK_TOOL(RANLIB,ranlib)
AC_CHECK_TOOL(STRIP,strip)
#
# overide with --prefix.
#
ac_default_prefix=/usr/testbed
#
# Okay, I know this is improper usage of --with. Too bad.
#
AC_ARG_WITH(TBDBNAME,
[ --with-TBDBNAME=name Specify TBDB name (tbdb default)],
[
if test "$withval" = "yes"; then
AC_MSG_ERROR(Invalid TBDBNAME - Must specify the value)
fi
TBDBNAME="$withval"
],[
TBDBNAME="tbdb"
])
AC_SUBST(TBDBNAME)
AC_ARG_WITH(LEDA,
[ --with-LEDA Specify LEDA path (/usr/testbed default)],
[
if test "$withval" = "yes"; then
LEDA="$ac_default_prefix/LEDA/LEDA-4.0"
else
LEDA="$withval"
fi
],[
LEDA="$ac_default_prefix/LEDA/LEDA-4.0"
])
AC_SUBST(LEDA)
#
# Optionally build with optimization or aggressive non-optimization
# (Actually three options: on, off or default.)
#
AC_ARG_ENABLE(debug,
[ --enable-debug Build with debug flags (-g -DDEBUG)
--disable-debug Build with optimization flags (-O2 -DNDEBUG -UDEBUG)])
if test "$enable_debug" = "yes"; then
OPT_CFLAGS="-g -DDEBUG";
else
if test "$enable_debug" = "no"; then
OPT_CFLAGS="-O2 -DNDEBUG -UDEBUG";
else
OPT_CFLAGS="-g -O";
fi
fi
AC_SUBST(OPT_CFLAGS)
# Make sure $INSTALL is valid at any depth in our tree, i.e. make it absoulte.
# This can be needed when no valid install is found and autoconf falls back on
# the supplied install.sh, but we called 'configure' with a relative path.
AC_PROG_INSTALL
[case "$INSTALL" in
..*)
INSTALL=`pwd`/$INSTALL
;;
esac]
outfiles="$outfiles Makeconf GNUmakefile \
assign/GNUmakefile \
capture/GNUmakefile \
db/GNUmakefile \
discvr/GNUmakefile \
lib/GNUmakefile \
os/GNUmakefile os/imagezip/GNUmakefile \
pxe/GNUmakefile pxe/proxydhcp.restart pxe/bootinfo.restart \
security/GNUmakefile \
tbsetup/GNUmakefile tbsetup/ir/GNUmakefile tbsetup/ns2ir/GNUmakefile \
tbsetup/checkpass/GNUmakefile \
tip/GNUmakefile \
tmcd/GNUmakefile tmcd/tmcd.restart \
www/GNUmakefile"
AC_OUTPUT($outfiles)
......@@ -2,15 +2,16 @@
# Insert Copyright Here.
#
include ../Makeconf
all:
include ../GNUmakerules
BINSCRIPTS = avail inuse mac2if nalloc nfree nodeip ptopgen \
showgraph tblog
ALLSCRIPTS = dbupdate usrud grpmemb user checkowner.tcl usrmod \
showgraph
ALLSCRIPTS = checkowner.tcl \
$(BINSCRIPTS)
all:
#
# Currently, all the stuff that gets installed in the bin directory
# gets duplicated in lib/tbsetup.
......@@ -30,4 +31,3 @@ $(INSTALL_LIBTBDIR)/%: %
$(INSTALL) $< $@
clean:
......@@ -2,6 +2,9 @@
# Insert Copyright Here.
#
include ../Makeconf
all: cli serv
include ../GNUmakerules
OBJS=get_ifi_info.o get_rtaddrs.o net_rt_iflist.o sock_ntop.o util.o
......@@ -11,8 +14,6 @@ LIBS = -lm
CFLAGS += -Wall -g
CC=gcc
all: cli serv
cli: ${OBJS} ${COBJS}
$(CC) $(LIBS) $(OBJS) $(COBJS) -o cli
......
......@@ -2,10 +2,11 @@
# Insert Copyright Here.
#
include ../Makeconf
include ../GNUmakerules
all: sql.so
include ../GNUmakerules
sql.so:
./mk_sqlso.sh
......
......@@ -2,19 +2,28 @@
# Insert Copyright Here.
#
include ../Makeconf
include ../GNUmakerules
SUBDIRS = imagezip
.PHONY: $(SUBDIRS)
all: $(SUBDIRS)
include ../GNUmakerules
imagezip:
@$(MAKE) -C imagezip all
install:
@$(MAKE) -C imagezip install
clean:
clean: subdir-clean
subdir-clean:
@$(MAKE) -C imagezip clean
distclean: subdir-distclean
subdir-distclean:
@$(MAKE) -C imagezip distclean
.PHONY: $(SUBDIRS)
include ../../Makeconf
all: imagezip imageunzip
include ../../GNUmakerules
CFLAGS = -O2 -g
LIBS = -lz
all: imagezip imageunzip
imagezip: imagezip.c
$(CC) $(CFLAGS) imagezip.c $(LIBS) -o imagezip
......
......@@ -2,17 +2,24 @@
# Insert Copyright Here.
#
include ../Makeconf
all: proxydhcp bootinfo
DISTCLEAN_FILES = proxydhcp.restart bootinfo.restart
include ../GNUmakerules
DBFLAG = -DUSE_MYSQL_DB #-DUSE_CFILE_DB #-DUSE_NULL_DB
DBFLAG = -DUSE_MYSQL_DB
#DBFLAG = -DUSE_CFILE_DB
#DBFLAG = -DUSE_NULL_DB
DBSRC = bootinfo_null.c bootinfo_cfile.c bootinfo_mysql.c
CFLAGS = -g -DSOLARIS -DHAVE_SOCKADDR_SA_LEN -DUSE_RECVMSG
CFLAGS = -g -DSOLARIS -DHAVE_SOCKADDR_SA_LEN -DUSE_RECVMSG \
-DCONFPATH='"$(INSTALL_ETCDIR)/"' -DTBDBNAME='"$(TBDBNAME)"'
INCS = -I/n/moab/z/mike/flux/install.debug/include
#INCS = -I/n/moab/z/stoller/oskit-debug/install/include
#INCS = -I/build/oskit-debug/install/include
all: proxydhcp bootinfo
proxydhcp: proxydhcp.c
cc $(CFLAGS) -o proxydhcp proxydhcp.c $(LFLAGS)
......@@ -27,24 +34,17 @@ testmysql: bootinfo_mysql.c
$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient
testcfile: bootinfo_cfile.c
cc $(CFLAGS) -DUSE_CFILE_DB -DTEST $(INCS) -o testcfile bootinfo_cfile.c \
$(LFLAGS)
cc $(CFLAGS) -DUSE_CFILE_DB -DTEST $(INCS) -o testcfile \
bootinfo_cfile.c $(LFLAGS)
install: all
install: $(INSTALL_BINDIR)/pxe/proxydhcp \
$(INSTALL_BINDIR)/pxe/bootinfo
$(INSTALL_DATA) proxydhcp.conf $(INSTALL_BINDIR)/pxe
$(INSTALL_PROGRAM) proxydhcp.restart $(INSTALL_BINDIR)/pxe
$(INSTALL_PROGRAM) bootinfo.restart $(INSTALL_BINDIR)/pxe
-mkdir -p $(INSTALL_DIR)/etc
$(INSTALL_DATA) bootinfo.conf $(INSTALL_DIR)/etc/bootinfo.conf
$(INSTALL_BINDIR)/pxe/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_BINDIR)/pxe
$(INSTALL_PROGRAM) $< $@
install: $(INSTALL_SBINDIR)/proxydhcp \
$(INSTALL_SBINDIR)/proxydhcp.restart \
$(INSTALL_SBINDIR)/bootinfo \
$(INSTALL_SBINDIR)/bootinfo.restart \
$(INSTALL_ETCDIR)/proxydhcp.conf \
$(INSTALL_ETCDIR)/bootinfo.conf
clean:
rm -f proxydhcp bootinfo testmysql
#!/bin/sh
DIR=/usr/testbed/bin/pxe
DIR=@prefix@/sbin
killall bootinfo
${DIR}/bootinfo > /dev/null 2>&1 &
......
......@@ -14,11 +14,7 @@
*/
#ifdef USE_CFILE_DB
#ifdef TEST
#define CFILE "bootinfo.conf"
#else
#define CFILE "/usr/testbed/etc/bootinfo.conf"
#endif
struct config {
struct in_addr client;
......@@ -39,7 +35,15 @@ static void print_bootwhat(boot_what_t *bootinfo);
int
open_bootinfo_db(void)
{
return parse_configs(CFILE);
char cfile[BUFSIZ];
#ifdef TEST
strcpy(cfile, CFILE);
#else
strcpy(cfile, CONFPATH);
strcat(cfile, CFILE);
#endif
return parse_configs(cfile);
}
int
......@@ -54,6 +58,12 @@ query_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
return 0;
}
int
ack_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
{
return 0;
}
int
close_bootinfo_db(void)
{
......
......@@ -8,7 +8,7 @@
#ifdef USE_MYSQL_DB
static char dbname[] = "tbdb";
static char dbname[] = TBDBNAME;
static MYSQL db;
int
......
#!/bin/sh
DIR=/usr/testbed/bin/pxe
killall proxydhcp
${DIR}/proxydhcp ${DIR}/proxydhcp.conf > /dev/null 2>&1 &
#!/bin/sh
IDIR=@prefix@/sbin
EDIR=@prefix@/etc
killall proxydhcp
${IDIR}/proxydhcp ${EDIR}/proxydhcp.conf > /dev/null 2>&1 &
......@@ -2,15 +2,16 @@
# Insert Copyright Here.
#
include ../Makeconf
include ../GNUmakerules
BINS = suexec
SCRIPTS = paperbag plasticwrap
CFLAGS = -O -g
all: $(BINS)
include ../GNUmakerules
CFLAGS = -O -g
suexec: suexec.c suexec.h
$(CC) $(CFLAGS) -o suexec suexec.c
......