aboutsummaryrefslogtreecommitdiff
path: root/default.do
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-12-21 10:02:45 +0000
committermerakor <cem@ckyln.com>2020-12-21 10:02:45 +0000
commitc1c68a205b8cbf0a8ee55f099c27d0a0c7f8afe2 (patch)
tree0e28e76b2391ba290180df87acdab6577d1dfe3f /default.do
parent08af0013de1d77cf0ee46245e50007a9fbf79035 (diff)
parent1535d115d8d0c58ca4a90acbf16b263cf85bb0a1 (diff)
downloadcpt-c1c68a205b8cbf0a8ee55f099c27d0a0c7f8afe2.tar.gz
Merge branch 'redo'
FossilOrigin-Name: 046e1a0012624ed9a8934a8a4099710264281bcb6814c1fc0fbe3157c1121d2f
Diffstat (limited to 'default.do')
-rw-r--r--default.do50
1 files changed, 50 insertions, 0 deletions
diff --git a/default.do b/default.do
new file mode 100644
index 0000000..c16f5f8
--- /dev/null
+++ b/default.do
@@ -0,0 +1,50 @@
+. ./config.rc
+
+# Extensionless name of file
+fn="${1%.*}"
+
+case "$1" in
+ all) redo-ifchange src/cpt-lib bin/all docs/all ;;
+ dist)
+ redo clean
+ redo "cpt-$VERSION.tar.xz"
+ ;;
+ src/cpt-lib)
+ redo-ifchange "$1.in"
+ sed "s|@VERSION@|$VERSION|g" < "$1.in" > "$3"
+ ;;
+ bin/cpt-readlink|bin/cpt-stat)
+ redo-ifchange "$1.o"
+ "$CC" -o "$3" $LDFLAGS "$1.o" $LIBS
+ ;;
+ *.o)
+ [ -f "${1%.o}.c" ] || exit 99
+ redo-ifchange "$fn.c"
+ "$CC" -c -o "$3" $CFLAGS "$fn.c"
+ ;;
+ "cpt-$VERSION.tar.xz")
+ redo docs/cpt.info
+ rm -rf -- "cpt-$VERSION"
+ mkdir -p "cpt-$VERSION"
+ { git ls-tree -r HEAD --name-only && echo docs/cpt.info ;} |
+ while read -r file; do
+ [ "${file##*/*}" ] ||
+ mkdir -p "cpt-$VERSION/${file%/*}"
+ cp "$file" "cpt-$VERSION/$file"
+ done
+ tar cf "cpt-$VERSION.tar" "cpt-$VERSION"
+ xz -z "cpt-$VERSION.tar"
+ rm -rf -- "cpt-$VERSION"
+ mv "$1" "$3"
+ ;;
+ test)
+ redo src/test bin/test
+ ;;
+ src/clean)
+ rm -f src/cpt-lib
+ PHONY
+ ;;
+ *)
+ echo "Unknown target $1"
+ exit 99
+esac