summaryrefslogtreecommitdiffstats
path: root/dist.sh
blob: 368d6a22876cd36af37025d242ddbcb638dacd43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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