aboutsummaryrefslogtreecommitdiff
path: root/tdump/scripts/gen-deps
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-10-29 14:38:33 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2023-10-29 14:38:33 +0200
commit5d29afb530ffdaab4b5032b7422da988b31c0867 (patch)
tree0135976b951fa4c860a043f07e6d555e40c60d1f /tdump/scripts/gen-deps
parent80d78c5589d42f81b04e671b28c103a2112458d1 (diff)
downloadtri-5d29afb530ffdaab4b5032b7422da988b31c0867.tar.gz
tri-5d29afb530ffdaab4b5032b7422da988b31c0867.zip
initial working compiled program on simulator
Diffstat (limited to 'tdump/scripts/gen-deps')
-rwxr-xr-xtdump/scripts/gen-deps37
1 files changed, 37 insertions, 0 deletions
diff --git a/tdump/scripts/gen-deps b/tdump/scripts/gen-deps
new file mode 100755
index 0000000..f45707c
--- /dev/null
+++ b/tdump/scripts/gen-deps
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PREFIX=
+COMPILE=COMPILE
+LINT=LINT
+BUILD=build/
+
+while getopts "p:c:b:l:" opt; do
+ case "$opt" in
+ p) PREFIX="$OPTARG"_;;
+ c) COMPILE="$OPTARG";;
+ l) LINT="$OPTARG";;
+ b) BUILD=build/"$OPTARG";;
+ *) echo "unrecognised option -$OPTARG" >&2; exit 1;;
+ esac
+done
+
+shift $((OPTIND - 1))
+
+# create all subdirectories
+mkdir -p $(echo "${@}" | tr ' ' '\n' | sed "s|[^/]*$||;s|^|${BUILD}/|" | uniq)
+
+for s in ${@}
+do
+ obj="${BUILD}/${s%.*}.o"
+ lint="${obj}.l"
+ dep="${obj}.d"
+
+ echo "${PREFIX}OBJS += ${obj}" >> deps.mk
+ echo "${PREFIX}LINTS += ${lint}" >> deps.mk
+ echo "${dep}:" >> deps.mk
+ echo "-include ${dep}" >> deps.mk
+ echo "${obj}: ${s}" >> deps.mk
+ echo " \$(${COMPILE}) -c ${s} -o ${obj}" >> deps.mk
+ echo "${lint}: ${s}" >> deps.mk
+ echo " \$(${LINT}) -c ${s} -o /dev/null" >> deps.mk
+done