#!/bin/sh

set -x

set -ue

cd /source

# we don't trust all makefile dependancies, esp lib/
rm -rf OBJ.linux.* modobj

# sometimes left behind - an error in "make check"
rm -f lib/libipsecconf/lex.yy.c lib/libipsecconf/parser.dot lib/libipsecconf/parser.output lib/libipsecconf/parser.tab.c lib/libipsecconf/parser.tab.h
# these are not wiped when running rm -rf OBJ*
rm -f lib/libswan/Makefile.depend lib/libipsecconf/Makefile.depend lib/libwhack/Makefile.depend programs/pluto/Makefile.depend

echo ">>> $0 on `hostname` at `date`" >>compile-log.txt

if ! make programs module >>compile-log.txt 2>&1
then
	echo '"make programs module"'" failed: $?; see compile-log.txt"
fi

echo "$0 finished on `hostname` at `date`"
