diff options
-rwxr-xr-x | .compile.do | 9 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rwxr-xr-x | .link-executable.do | 8 | ||||
-rwxr-xr-x | .link-library.do | 10 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | all.do | 0 | ||||
-rwxr-xr-x | clean | 2 | ||||
-rwxr-xr-x | configure | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | default.o.do | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | libpack.so.do | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | test.do | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | test.inc.do | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | test.o.do | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | test_gen.do | 0 |
14 files changed, 27 insertions, 37 deletions
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 @@ -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 @@ -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 ------------ @@ -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 @@ -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 index 121c3c0..121c3c0 100644..100755 --- a/default.o.do +++ b/default.o.do diff --git a/libpack.so.do b/libpack.so.do index d656dbc..d656dbc 100644..100755 --- a/libpack.so.do +++ b/libpack.so.do diff --git a/test.inc.do b/test.inc.do index 1fcd448..ebedd07 100644..100755 --- 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 index f90e621..f90e621 100644..100755 --- a/test.o.do +++ b/test.o.do diff --git a/test_gen.do b/test_gen.do index c1b6dc6..c1b6dc6 100644..100755 --- a/test_gen.do +++ b/test_gen.do |