summaryrefslogtreecommitdiff
path: root/compile_make.sh
diff options
context:
space:
mode:
Diffstat (limited to 'compile_make.sh')
-rwxr-xr-xcompile_make.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/compile_make.sh b/compile_make.sh
new file mode 100755
index 0000000..78bc6c0
--- /dev/null
+++ b/compile_make.sh
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+
+defined() {
+ [ x"$2" = x ] && echo $1 is undefined && exit 1
+ echo $1 = $2
+}
+
+pexec() {
+ echo $@
+ $@
+}
+
+defined CC "$CC"
+defined LD "$LD"
+
+arch=x86_64
+
+gcc_prefix=$(dirname $(gcc -print-libgcc-file-name))
+
+tool_cflags="-Wall -nostdinc -Wno-main \
+ -ffreestanding -fno-pic -fno-stack-protector \
+ -Igenerated/include -Iarch/$arch \
+ -I${gcc_prefix}/include -Iarch/generic"
+
+cflags="$tool_cflags $CFLAGS"
+
+pexec $CC $cflags -c -o tools/common.o tools/common.c
+pexec $CC $cflags -c -o tools/make.o tools/make.c
+pexec $LD -nostdlib -o tools/make tools/make.o tools/common.o