summaryrefslogtreecommitdiffstats
path: root/dist.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dist.sh')
-rwxr-xr-xdist.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/dist.sh b/dist.sh
new file mode 100755
index 0000000..368d6a2
--- /dev/null
+++ b/dist.sh
@@ -0,0 +1,44 @@
+#!/bin/zsh
+setopt null_glob
+cd $(dirname $(realpath $0))
+SRCDIR=$PWD/../
+SRCDIR=${SRCDIR:a}
+
+pushd ..
+for script in $PWD/*.c4{d,f,g}/predist.sh; do
+ pushd ${script:h:t}
+ echo Executing $script in $PWD...
+ $script
+ popd
+done
+popd
+
+mv TodsStuff.c4d TodsStuff_bak.c4d
+mkdir TodsStuff.c4d
+pushd TodsStuff.c4d
+cp -r ../../*.{c4{d,f,g},txt} .
+rm -rf **/.git* *.c4{d,f,g}/predist.sh
+for file in **/*.cp; do
+ echo Preprocessing $file...
+ c4cpp $file ${file%.cp}.c
+ rm $file
+done
+
+for script in $PWD/*.c4{d,f,g}/dist.sh; do
+ pushd ${script:h:t}
+ export SRC=$SRCDIR/${PWD:t}
+ export DST=$PWD
+ echo Executing $script in $PWD...
+ $script
+ rm $script
+ popd
+done
+
+popd
+pushd TodsStuff_bak.c4d
+files=(**/.git*)
+popd
+for file in $files; do
+ cp TodsStuff_bak.c4d/$file TodsStuff.c4d/$file
+done
+rm -r TodsStuff_bak.c4d