diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | all.do | 2 | ||||
-rwxr-xr-x | configure | 5 | ||||
-rw-r--r-- | default.o.do | 5 | ||||
-rw-r--r-- | link | 4 | ||||
-rw-r--r-- | loadargs | 8 | ||||
-rwxr-xr-x | scripts/clean | 2 | ||||
-rw-r--r-- | test_gen.do | 3 | ||||
-rw-r--r-- | unpack_test.do | 3 | ||||
-rw-r--r-- | unpack_test.inc.do | 3 | ||||
-rw-r--r-- | unpack_test.o.do | 4 |
12 files changed, 41 insertions, 9 deletions
@@ -1,4 +1,6 @@ +*.d *.o *_test *.inc *_gen +*.args diff --git a/Makefile b/Makefile deleted file mode 100644 index d8037f6..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2020 Tomasz Kramkowski <tk@the-tk.com> -# SPDX-License-Identifier: MIT -unpack_test: unpack_test.o unpack.o common.o trace.o -unpack_test.o: unpack_test.c pack.h trace.h common.h unpack_test.inc -trace.o: trace.c trace.h -common.o: common.c common.h -unpack_test.inc: test_gen - ./$< >$@ -test_gen: test_gen.o @@ -0,0 +1,2 @@ +#!/bin/sh +redo-ifchange "$0" "unpack_test" diff --git a/configure b/configure new file mode 100755 index 0000000..70a0698 --- /dev/null +++ b/configure @@ -0,0 +1,5 @@ +#!/bin/sh + +for f in args/"$1"/*; do + ln -sf "$f" +done diff --git a/default.o.do b/default.o.do new file mode 100644 index 0000000..9135cb8 --- /dev/null +++ b/default.o.do @@ -0,0 +1,5 @@ +#!/bin/bash +redo-ifchange "$0" "default.o.do" "$2.c" +. loadargs "compile" +gcc -std=c11 -MD -MF "$2.d" -c -o "$3" "${args[@]}" "$2.c" +redo-ifchange "$2.d" $(sed ':a;/\\$/{s/[^:]*: //;N;s/ \\\n//;ba}' <"$2.d") @@ -0,0 +1,4 @@ +#/fake/bash +redo-ifchange "$0" "link" "${deps[@]}" +. loadargs "link" +gcc -o "$3" "${deps[@]}" diff --git a/loadargs b/loadargs new file mode 100644 index 0000000..3ec8b0d --- /dev/null +++ b/loadargs @@ -0,0 +1,8 @@ +#/fake/bash +if [ -r "$1.args" ]; then + redo-ifchange "$1.args" + mapfile -t args <"$1.args" +else + redo-ifcreate "$1.args" + args=() +fi diff --git a/scripts/clean b/scripts/clean new file mode 100755 index 0000000..97d7b0f --- /dev/null +++ b/scripts/clean @@ -0,0 +1,2 @@ +#!/bin/sh +find . \( -name '*.d' -o -name '*.o' -o -name '*_gen' -o -name '*.inc' \) -delete diff --git a/test_gen.do b/test_gen.do new file mode 100644 index 0000000..ed0f2e4 --- /dev/null +++ b/test_gen.do @@ -0,0 +1,3 @@ +#!/bin/bash +deps=(test_gen.o) +. ./link diff --git a/unpack_test.do b/unpack_test.do new file mode 100644 index 0000000..9c810c6 --- /dev/null +++ b/unpack_test.do @@ -0,0 +1,3 @@ +#!/bin/bash +deps=(unpack_test.o common.o unpack.o trace.o) +. ./link diff --git a/unpack_test.inc.do b/unpack_test.inc.do new file mode 100644 index 0000000..c6d5c1b --- /dev/null +++ b/unpack_test.inc.do @@ -0,0 +1,3 @@ +#!/bin/sh +redo-ifchange "$0" "test_gen" +./test_gen diff --git a/unpack_test.o.do b/unpack_test.o.do new file mode 100644 index 0000000..a7c32b8 --- /dev/null +++ b/unpack_test.o.do @@ -0,0 +1,4 @@ +#!/bin/bash +redo-ifchange "unpack_test.inc" +set -- "$1" "${2%.o}" "$3" +. ./default.o.do |