Archived
1
0
Fork 0
This repository has been archived on 2025-09-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
skcblitz/compile.sh

25 lines
580 B
Bash
Raw Normal View History

2025-09-02 14:43:36 +02:00
#!/bin/bash
BUILD_ID=1
if [ -e build.txt ]; then
BUILD_ID=$(cat build.txt)
let BUILD_ID=BUILD_ID+1
fi
MODIFIED=0
if [ -e skcblitz ]; then
MODIFIED=$(date -r skcblitz +%s)
fi
for header in *.h *.c; do
if [ $(date -r "$header" +%s) -gt $MODIFIED ]; then
if gcc -rdynamic -g -DBUILD_DATE="\"$(date)\"" -DBUILD_SYS="\"$(uname -snrm)\"" -DBUILD_ID=$BUILD_ID -DBUILD_COMP="\"$(gcc --version | head -n 1)\"" -o skcblitz program.c -lm -lX11 -ldl -lasound -pthread; then
echo -n $BUILD_ID > build.txt
echo "Build $BUILD_ID"
break;
else
exit 1;
fi
fi
done
set -x
$@