summaryrefslogtreecommitdiffhomepage
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rwxr-xr-xproject/clbuild.sh43
-rw-r--r--project/extras.mk5
2 files changed, 38 insertions, 10 deletions
diff --git a/project/clbuild.sh b/project/clbuild.sh
index f69745e..a9a846b 100755
--- a/project/clbuild.sh
+++ b/project/clbuild.sh
@@ -6,20 +6,32 @@ error_msg()
echo $@ >&2
}
+mb_cc=
+mb_ar=
mb_source_dir=
mb_project_dir=
+mb_sysroot=
# one: args
for arg ; do
case "$arg" in
--help) usage
;;
+ --cc=*)
+ mb_cc=${arg#*=}
+ ;;
+ --ar=*)
+ mb_ar=${arg#*=}
+ ;;
--source-dir=*)
mb_source_dir=${arg#*=}
;;
--project-dir=*)
mb_project_dir=${arg#*=}
;;
+ --sysroot=*)
+ mb_sysroot=${arg#*=}
+ ;;
*)
error_msg ${arg#}: "unsupported config argument."
exit 2
@@ -27,7 +39,9 @@ for arg ; do
esac
done
-if [ -z "$mb_source_dir" ] || [ -z "$mb_project_dir" ]; then
+if [ -z "$mb_cc" ] || [ -z "$mb_ar" ] \
+ || [ -z "$mb_source_dir" ] \
+ || [ -z "$mb_project_dir" ]; then
usage
fi
@@ -74,7 +88,7 @@ make shared-objs static-objs app-objs \
| grep -v 'touch version.tag' \
| grep -v 'touch app.tag' \
| sed \
- -e 's@cc @cl /nologo @' \
+ -e 's@'"$mb_cc -c "'@cl /nologo -c @' \
-e 's@ '"$mb_source_dir"'@ %source_dir%@' \
-e 's@-I'"$mb_source_dir"'@-I%source_dir%@g' \
-e 's@-ffreestanding@/X@g' \
@@ -97,6 +111,7 @@ make shared-objs static-objs app-objs \
-e 's@-Werror @/WX @g' \
-e 's@-Wextra @@g' \
-e 's@-Wundef @/Wall @g' \
+ -e 's@'"$mb_sysroot "'@ @' \
-e 's,$, -I%sysroot%/include\n\n'"$cmd_abort_on_error"'\n,g'
echo
@@ -106,14 +121,18 @@ echo '@echo.'
echo
# six: create static archive
-make static \
- | grep -v 'make\[1\]:' \
- | grep -v "rm -f " \
- | sed \
- -e 's@ar rcs @lib /out:@' \
+make static \
+ | grep -v 'make\[1\]:' \
+ | grep -v "rm -f " \
+ | sed \
+ -e 's@'"$mb_ar"' rcs @lib /out:@' \
-e 's,$, /nologo\n,g'
echo
+echo "$cmd_abort_on_error"
+echo
+
+echo
echo '@echo.'
echo '@echo clbuild: successfully created: static archive.'
echo '@echo.'
@@ -123,14 +142,20 @@ echo
make LDFLAGS_IMPLIB= LDFLAGS_SONAME= shared-lib \
| grep -v 'make\[1\]:' \
| sed \
- -e 's@cc -shared @link /dll /nologo @' \
+ -e 's@'"$mb_cc"' -shared @link /dll /nologo @' \
-e 's@-o @/out:@g' \
- -e 's@ -L@/libpath:@g' \
+ -e 's@ -L@ /libpath:@g' \
-e 's@-nostdlib @/nodefaultlib @g' \
-e 's@-Wl,--subsystem=@/subsystem:@g' \
+ -e 's@-Wl,--entry -Wl,'"''"'@/entry:@g' \
-e 's@-Wl,--entry -Wl,@/entry:@g' \
-e 's@-Wl,--no-undefined@@g' \
-e 's@-Wl,--exclude-all-symbols@@g' \
+ -e 's@'"$mb_sysroot "'@ @' \
+
+echo
+echo "$cmd_abort_on_error"
+echo
echo
echo '@echo.'
diff --git a/project/extras.mk b/project/extras.mk
index f208e19..7216a32 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -27,5 +27,8 @@ install-headers-custom: install-headers-default
clbuild-bat:
@$(PROJECT_DIR)/project/clbuild.sh \
+ --cc=$(CC) \
+ --ar=$(AR) \
--source-dir=$(SOURCE_DIR) \
- --project-dir=$(PROJECT_DIR)
+ --project-dir=$(PROJECT_DIR) \
+ --sysroot=$(CFLAGS_SYSROOT)