freebsd-skq/contrib/bmake/make-bootstrap.sh.in
Simon J. Gerraty e22fef7dc1 Update to bmake-20171028
Ignore empty MAKEOBJDIR[PREFIX]

Reported by:	bdrewery
2017-11-02 20:08:00 +00:00

85 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
set -e
srcdir=@srcdir@
DEFAULT_SYS_PATH="@default_sys_path@"
case "@use_meta@" in
yes) XDEFS="-DUSE_META ${XDEFS}";;
esac
CC="@CC@"
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
MAKE_VERSION=@_MAKE_VERSION@
MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
-D@force_machine@MACHINE=\"@machine@\" -DMACHINE_ARCH=\"@machine_arch@\" \
-D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\""
LDFLAGS="@LDFLAGS@"
LIBS="@LIBS@"
do_compile2() {
obj="$1"; shift
src="$1"; shift
echo ${CC} -c ${CFLAGS} "$@" -o "$obj" "$src"
${CC} -c ${CFLAGS} "$@" -o "$obj" "$src"
}
do_compile() {
obj="$1"; shift
src=`basename "$obj" .o`.c
for d in "$srcdir" "$srcdir/lst.lib"
do
test -s "$d/$src" || continue
do_compile2 "$obj" "$d/$src" "$@" || exit 1
return
done
echo "Unknown object file '$obj'" >&2
exit 1
}
do_link() {
output="$1"; shift
echo ${CC} ${LDSTATIC} ${LDFLAGS} -o "$output" "$@" ${LIBS}
${CC} ${LDSTATIC} ${LDFLAGS} -o "$output" "$@" ${LIBS}
}
BASE_OBJECTS="arch.o buf.o compat.o cond.o dir.o for.o getopt hash.o \
job.o make.o make_malloc.o metachar.o parse.o sigcompat.o str.o strlist.o \
suff.o targ.o trace.o var.o util.o"
LST_OBJECTS="lstAppend.o lstDupl.o lstInit.o lstOpen.o \
lstAtEnd.o lstEnQueue.o lstInsert.o lstAtFront.o lstIsAtEnd.o \
lstClose.o lstFind.o lstIsEmpty.o lstRemove.o lstConcat.o \
lstFindFrom.o lstLast.o lstReplace.o lstFirst.o lstDatum.o \
lstForEach.o lstMember.o lstSucc.o lstDeQueue.o lstForEachFrom.o \
lstDestroy.o lstNext.o lstPrev.o"
LIB_OBJECTS="@LIBOBJS@"
do_compile main.o ${MDEFS}
for o in ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}
do
do_compile "$o"
done
case "@use_meta@" in
yes)
case "@filemon_h@" in
*/filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
esac
do_compile meta.o ${FDEFS}
BASE_OBJECTS="meta.o ${BASE_OBJECTS}"
;;
esac
do_link bmake main.o ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}