From 5107f97c50b1ea37df341fd9b06f61694ebb9b3f Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 14 Jul 2021 11:40:30 +0100 Subject: Update redo scripts to work with jdebp redo --- .compile.do | 9 ++------- .gitignore | 3 ++- .link-executable.do | 8 ++------ .link-library.do | 10 +++------- README.md | 15 ++++++++++----- all.do | 0 clean | 2 +- configure | 15 ++++++--------- default.o.do | 0 libpack.so.do | 0 test.do | 0 test.inc.do | 2 +- test.o.do | 0 test_gen.do | 0 14 files changed, 27 insertions(+), 37 deletions(-) mode change 100644 => 100755 all.do mode change 100644 => 100755 default.o.do mode change 100644 => 100755 libpack.so.do mode change 100644 => 100755 test.do mode change 100644 => 100755 test.inc.do mode change 100644 => 100755 test.o.do mode change 100644 => 100755 test_gen.do diff --git a/.compile.do b/.compile.do index 310ddd5..2a8d932 100755 --- a/.compile.do +++ b/.compile.do @@ -3,11 +3,6 @@ redo-ifchange .config.rc . ./.config.rc exec >"$3" echo "# generated by $0" -echo "CC=$CC" -echo "CFLAGS=(${CFLAGS[@]@Q})" -echo "CPPFLAGS=(${CPPFLAGS[@]@Q})" +declare -p CC CFLAGS CPPFLAGS echo '"$CC" -MMD -MF "${1%.o}.d" "${CFLAGS[@]}" "${CPPFLAGS[@]}" -c -o "$3" "${1%.o}.c"' -command -v redo-stamp >/dev/null 2>&1 && redo-stamp <"$3" -if command -v redo-stamp >/dev/null 2>&1; then - redo-stamp <"$3" -fi +if command -v redo-stamp &>/dev/null; then redo-stamp <"$3"; fi diff --git a/.gitignore b/.gitignore index 20bca3b..0fd3620 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .link-executable .link-library .redo/ +all +compile_flags.txt test test_gen -compile_flags.txt diff --git a/.link-executable.do b/.link-executable.do index 4d7abdd..bb3dea6 100755 --- a/.link-executable.do +++ b/.link-executable.do @@ -3,10 +3,6 @@ redo-ifchange .config.rc . ./.config.rc exec >"$3" echo "# generated by $0" -echo "CC=$CC" -echo "LDFLAGS=(${LDFLAGS[@]@Q})" -echo "LDLIBS=(${LDLIBS[@]@Q})" +declare -p CC LDFLAGS LDLIBS echo '"$CC" "${LDFLAGS[@]}" "${objects[@]}" "${LDLIBS[@]}" -o "$3"' -if command -v redo-stamp >/dev/null 2>&1; then - redo-stamp <"$3" -fi +if command -v redo-stamp &>/dev/null; then redo-stamp <"$3"; fi diff --git a/.link-library.do b/.link-library.do index 09aaf90..7a7aad2 100755 --- a/.link-library.do +++ b/.link-library.do @@ -3,10 +3,6 @@ redo-ifchange .config.rc . ./.config.rc exec >"$3" echo "# generated by $0" -echo "CC=$CC" -echo "LDFLAGS=(${LDFLAGS[@]@Q} -shared)" -echo "LDLIBS=(${LDLIBS[@]@Q})" -echo '"$CC" "${LDFLAGS[@]}" "${objects[@]}" "${LDLIBS[@]}" -o "$3"' -if command -v redo-stamp >/dev/null 2>&1; then - redo-stamp <"$3" -fi +declare -p CC LDFLAGS LDLIBS +echo '"$CC" "${LDFLAGS[@]}" -shared "${objects[@]}" "${LDLIBS[@]}" -o "$3"' +if command -v redo-stamp &>/dev/null; then redo-stamp <"$3"; fi diff --git a/README.md b/README.md index ddfec17..293a1c7 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,31 @@ Pack is a simple serialisation and deserialisation library for C. Dependencies ------------ -- A apenwarr redo compatible redo implementation +- A redo implementation (Tested with apenwarr and jdebp) - A relatively recent copy of bash -- A c compiler with C11 support +- A C compiler with C11 support Compilation ----------- Run `./configure` (see `./configure -h` for additional options). -Run `redo all` to build the code and tests. +Run `redo all` to build the library and tests. Testing ------- Run `./test` to run all the tests. +Installation +------------ + +Not implemented yet. + Development ----------- -Please configure with `-w` and ensure code compiles cleanly. Although compiler -versions can enable different warnings. +Please configure with `-w` and ensure code compiles cleanly. Be aware that +different compiler versions can enable different warnings. If in doubt, ask. Contributing ------------ diff --git a/all.do b/all.do old mode 100644 new mode 100755 diff --git a/clean b/clean index 5b42c43..246aa82 100755 --- a/clean +++ b/clean @@ -1,3 +1,3 @@ #!/bin/sh find . -type f \( -name '*.d' -o -name '*.o' -o -name '*.inc' \) -exec rm -f {} + -rm -f .compile .link-library .link-executable test_gen test +rm -f .compile .link-library .link-executable test_gen test libpack.so all diff --git a/configure b/configure index d3ea49e..431dc4a 100755 --- a/configure +++ b/configure @@ -1,5 +1,10 @@ #!/bin/bash +CFLAGS=(-std=c11 -fPIC) +CPPFLAGS=() +LDLIBS=() +LDFLAGS=() + warnings=( -Wall -Wcast-align -Wcast-qual -Wextra -Wpedantic -Wformat=2 -Winit-self -Wmissing-prototypes -Wpointer-arith -Wshadow @@ -7,8 +12,6 @@ warnings=( -Wsuggest-attribute=noreturn ) -CFLAGS+=(-std=c11 -fPIC) - usage () { echo "Usage: $0 [-h|options...]"; } help () { @@ -28,7 +31,6 @@ Options: -w Enable warning flags Environment: CC C compiler - PKG_CONFIG pkg-config EOF } @@ -45,7 +47,6 @@ check() { return 1 } - CC=$(check '$CC, cc, gcc or clang' "$CC" cc gcc clang) || exit colour=auto @@ -75,11 +76,7 @@ fi { echo "# generated using $0 $@" - echo "CC=$CC" - echo "CFLAGS=(${CFLAGS[@]@Q})" - echo "CPPFLAGS=(${CPPFLAGS[@]@Q})" - echo "LDFLAGS=(${LDFLAGS[@]@Q})" - echo "LDLIBS=(${LDLIBS[@]@Q})" + declare -p CC CFLAGS CPPFLAGS LDFLAGS LDLIBS } >.config.rc [[ $verbose ]] && cat .config.rc [[ $gen_flags ]] && printf '%s\n' "${CFLAGS[@]}" "${CPPFLAGS[@]}" >compile_flags.txt diff --git a/default.o.do b/default.o.do old mode 100644 new mode 100755 diff --git a/libpack.so.do b/libpack.so.do old mode 100644 new mode 100755 diff --git a/test.do b/test.do old mode 100644 new mode 100755 diff --git a/test.inc.do b/test.inc.do old mode 100644 new mode 100755 index 1fcd448..ebedd07 --- a/test.inc.do +++ b/test.inc.do @@ -1,3 +1,3 @@ #!/bin/sh redo-ifchange test_gen -./test_gen >$3 +./test_gen >"$3" diff --git a/test.o.do b/test.o.do old mode 100644 new mode 100755 diff --git a/test_gen.do b/test_gen.do old mode 100644 new mode 100755 -- cgit v1.2.3-54-g00ecf