2012-06-08 21:57:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
srcdir=@srcdir@
|
|
|
|
|
|
|
|
DEFAULT_SYS_PATH="@default_sys_path@"
|
|
|
|
|
|
|
|
case "@use_meta@" in
|
|
|
|
yes) XDEFS="-DUSE_META ${XDEFS}";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CC="@CC@"
|
2014-01-26 07:40:17 +00:00
|
|
|
CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2017-11-01 23:16:32 +00:00
|
|
|
MAKE_VERSION=@_MAKE_VERSION@
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
|
2020-11-20 03:54:37 +00:00
|
|
|
-D@force_machine@MACHINE=\"@machine@\" \
|
|
|
|
-D@force_machine_arch@MACHINE_ARCH=\"@machine_arch@\" \
|
2012-06-08 21:57:36 +00:00
|
|
|
-D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\""
|
|
|
|
|
|
|
|
|
|
|
|
LDFLAGS="@LDFLAGS@"
|
|
|
|
LIBS="@LIBS@"
|
|
|
|
|
2020-05-20 19:34:48 +00:00
|
|
|
toUpper() {
|
|
|
|
${TR:-tr} abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
|
|
|
}
|
|
|
|
|
2012-06-08 21:57:36 +00:00
|
|
|
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
|
2020-05-20 19:34:48 +00:00
|
|
|
case "$1" in
|
|
|
|
*.c) src=$1; shift;;
|
|
|
|
*) src=`basename "$obj" .o`.c;;
|
|
|
|
esac
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
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}
|
|
|
|
}
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
BASE_OBJECTS="arch.o buf.o compat.o cond.o dir.o enum.o for.o getopt hash.o \
|
2020-11-20 03:54:37 +00:00
|
|
|
lst.o make.o make_malloc.o metachar.o parse.o sigcompat.o str.o \
|
2012-06-08 21:57:36 +00:00
|
|
|
suff.o targ.o trace.o var.o util.o"
|
|
|
|
|
|
|
|
LIB_OBJECTS="@LIBOBJS@"
|
|
|
|
|
|
|
|
do_compile main.o ${MDEFS}
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
for o in ${BASE_OBJECTS} ${LIB_OBJECTS}
|
2012-06-08 21:57:36 +00:00
|
|
|
do
|
|
|
|
do_compile "$o"
|
|
|
|
done
|
|
|
|
|
|
|
|
case "@use_meta@" in
|
|
|
|
yes)
|
2020-05-20 19:34:48 +00:00
|
|
|
case "@use_filemon@" in
|
|
|
|
no) MDEFS=;;
|
|
|
|
*)
|
|
|
|
MDEFS="-DUSE_FILEMON -DUSE_FILEMON_`echo @use_filemon@ | toUpper`"
|
|
|
|
case "@use_filemon@,@filemon_h@" in
|
|
|
|
dev,*/filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
|
|
|
|
*) FDEFS=;;
|
|
|
|
esac
|
|
|
|
do_compile filemon_@use_filemon@.o filemon/filemon_@use_filemon@.c ${FDEFS}
|
|
|
|
BASE_OBJECTS="filemon_@use_filemon@.o $BASE_OBJECTS"
|
|
|
|
;;
|
2012-06-08 21:57:36 +00:00
|
|
|
esac
|
2020-05-20 19:34:48 +00:00
|
|
|
do_compile meta.o ${MDEFS}
|
|
|
|
BASE_OBJECTS="meta.o ${BASE_OBJECTS}"
|
|
|
|
;;
|
2012-06-08 21:57:36 +00:00
|
|
|
esac
|
2020-05-20 19:34:48 +00:00
|
|
|
do_compile job.o ${MDEFS}
|
2012-06-08 21:57:36 +00:00
|
|
|
|
2020-05-20 19:34:48 +00:00
|
|
|
do_link bmake main.o job.o ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}
|