diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2012-06-08 21:57:36 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2012-06-08 21:57:36 +0000 |
commit | b379932fc0f836f9f3f5ac89ef7f6cd38377dff8 (patch) | |
tree | 18db9ddd684d6278a8a49b3850dc7c757c7e8348 /make-bootstrap.sh.in | |
parent | 3e4da6f5b3dfa3b4ff9caabcbc673d721a1a9bf0 (diff) | |
download | src-b379932fc0f836f9f3f5ac89ef7f6cd38377dff8.tar.gz src-b379932fc0f836f9f3f5ac89ef7f6cd38377dff8.zip |
Import the 6-May-2012 release of the "Portable" BSD make tool (from NetBSD).vendor/NetBSD/bmake/20120606
Submitted by: sjg@juniper.net
Notes
Notes:
svn path=/vendor/NetBSD/bmake/dist/; revision=236769
svn path=/vendor/NetBSD/bmake/20120606/; revision=236770; tag=vendor/NetBSD/bmake/20120606
Diffstat (limited to 'make-bootstrap.sh.in')
-rwxr-xr-x | make-bootstrap.sh.in | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/make-bootstrap.sh.in b/make-bootstrap.sh.in new file mode 100755 index 000000000000..d9ff9ff961a0 --- /dev/null +++ b/make-bootstrap.sh.in @@ -0,0 +1,84 @@ +#!/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}" + +MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' Makefile` + +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 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} |