Add support for various sysconf(3) / confstr(3) / getconf(1) constants.
[dragonfly.git] / contrib / bmake / make-bootstrap.sh.in
blob2bb4c25a7058cf1f1eef01a9de3aaae83d78ccac
1 #!/bin/sh
3 set -e
5 srcdir=@srcdir@
7 DEFAULT_SYS_PATH="@default_sys_path@"
9 case "@use_meta@" in
10 yes) XDEFS="-DUSE_META ${XDEFS}";;
11 esac
13 CC="@CC@"
14 CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@"
16 MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile`
18 MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \
19 -D@force_machine@MACHINE=\"@machine@\" -DMACHINE_ARCH=\"@machine_arch@\" \
20 -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\""
23 LDFLAGS="@LDFLAGS@"
24 LIBS="@LIBS@"
26 do_compile2() {
27 obj="$1"; shift
28 src="$1"; shift
29 echo ${CC} -c ${CFLAGS} "$@" -o "$obj" "$src"
30 ${CC} -c ${CFLAGS} "$@" -o "$obj" "$src"
33 do_compile() {
34 obj="$1"; shift
35 src=`basename "$obj" .o`.c
37 for d in "$srcdir" "$srcdir/lst.lib"
39 test -s "$d/$src" || continue
41 do_compile2 "$obj" "$d/$src" "$@" || exit 1
42 return
43 done
44 echo "Unknown object file '$obj'" >&2
45 exit 1
48 do_link() {
49 output="$1"; shift
50 echo ${CC} ${LDSTATIC} ${LDFLAGS} -o "$output" "$@" ${LIBS}
51 ${CC} ${LDSTATIC} ${LDFLAGS} -o "$output" "$@" ${LIBS}
54 BASE_OBJECTS="arch.o buf.o compat.o cond.o dir.o for.o getopt hash.o \
55 job.o make.o make_malloc.o parse.o sigcompat.o str.o strlist.o \
56 suff.o targ.o trace.o var.o util.o"
58 LST_OBJECTS="lstAppend.o lstDupl.o lstInit.o lstOpen.o \
59 lstAtEnd.o lstEnQueue.o lstInsert.o lstAtFront.o lstIsAtEnd.o \
60 lstClose.o lstFind.o lstIsEmpty.o lstRemove.o lstConcat.o \
61 lstFindFrom.o lstLast.o lstReplace.o lstFirst.o lstDatum.o \
62 lstForEach.o lstMember.o lstSucc.o lstDeQueue.o lstForEachFrom.o \
63 lstDestroy.o lstNext.o lstPrev.o"
65 LIB_OBJECTS="@LIBOBJS@"
67 do_compile main.o ${MDEFS}
69 for o in ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}
71 do_compile "$o"
72 done
74 case "@use_meta@" in
75 yes)
76 case "@filemon_h@" in
77 */filemon.h) FDEFS="-DHAVE_FILEMON_H -I`dirname @filemon_h@`";;
78 esac
79 do_compile meta.o ${FDEFS}
80 BASE_OBJECTS="meta.o ${BASE_OBJECTS}"
82 esac
84 do_link bmake main.o ${BASE_OBJECTS} ${LST_OBJECTS} ${LIB_OBJECTS}