aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Redofile22
-rwxr-xr-xbuild.sh4
-rw-r--r--out/redo-ifcreate.do5
-rw-r--r--src/redo-ifcreate.c17
5 files changed, 39 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index c6164a3..7fa7159 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
out/*.o
out/redo
out/redo-ifchange
+out/redo-ifcreate
out/redo-always
out/CC
.redo
diff --git a/Redofile b/Redofile
index a1bdd41..ab241f9 100644
--- a/Redofile
+++ b/Redofile
@@ -8,15 +8,19 @@ export VERSION="pre-0.01"
DESTDIR=${DESTDIR-/usr/bin}
if [ "$1" = "all" ]; then
- redo-ifchange $OUTDIR/redo $OUTDIR/redo-ifchange
+ redo-ifchange $OUTDIR/redo $OUTDIR/redo-ifchange $OUTDIR/redo-ifcreate \
+ $OUTDIR/redo-always
elif [ "$1" = "clean" ]; then
- rm -rf $OUTDIR/*.tmp $OUTDIR/*.o $OUTDIR/redo $OUTDIR/redo-ifchange $OUTDIR/CC
- # autoconf stuff
- rm -rf autom4te.cache config.h.in configure config.status config.log config.h
+ rm -rf $OUTDIR/*.tmp $OUTDIR/*.o $OUTDIR/redo $OUTDIR/redo-ifchange \
+ $OUTDIR/redo-ifcreate $OUTDIR/redo-always $OUTDIR/CC
+ # autoconf stuff
+ rm -rf autom4te.cache config.h.in configure config.status config.log config.h
elif [ "$1" = "install" ]; then
- redo-ifchange all
- mkdir -p $DESTDIR
- install $OUTDIR/redo $DESTDIR
- install $OUTDIR/redo-ifchange $DESTDIR
- echo "Finished installing."
+ redo-ifchange all
+ mkdir -p $DESTDIR
+ install $OUTDIR/redo $DESTDIR
+ install $OUTDIR/redo-ifchange $DESTDIR
+ install $OUTDIR/redo-ifcreate $DESTDIR
+ install $OUTDIR/redo-always $DESTDIR
+ echo "Finished installing."
fi
diff --git a/build.sh b/build.sh
index aeb1f60..1bee8a1 100755
--- a/build.sh
+++ b/build.sh
@@ -6,12 +6,14 @@ $CC $CFLAGS -o out/build.o -c src/build.c
$CC $CFLAGS -o out/filepath.o -c src/filepath.c
$CC $CFLAGS -o out/redo.o -c src/redo.c
$CC $CFLAGS -o out/redo-ifchange.o -c src/redo-ifchange.c
+$CC $CFLAGS -o out/redo-ifcreate.o -c src/redo-ifcreate.c
$CC $CFLAGS -o out/redo-always.o -c src/redo-always.c
$CC -o out/redo out/redo.o out/util.o out/build.o out/filepath.o $LDFLAGS
$CC -o out/redo-ifchange out/redo-ifchange.o out/util.o out/build.o out/filepath.o $LDFLAGS
+$CC -o out/redo-ifcreate out/redo-ifcreate.o out/util.o out/build.o out/filepath.o $LDFLAGS
$CC -o out/redo-always out/redo-always.o out/util.o out/build.o out/filepath.o $LDFLAGS
# TODO: just for convenience, should be removed as soon as redo can build itself
-sudo install out/redo out/redo-ifchange out/redo-always /usr/bin/
+sudo install out/redo out/redo-ifchange out/redo-ifcreate out/redo-always /usr/bin/
echo "Finished compiling"
diff --git a/out/redo-ifcreate.do b/out/redo-ifcreate.do
new file mode 100644
index 0000000..4ab8f85
--- /dev/null
+++ b/out/redo-ifcreate.do
@@ -0,0 +1,5 @@
+. ./config.sh
+
+DEPS="redo-ifcreate.o build.o util.o filepath.o"
+redo-ifchange $DEPS config.sh
+$CC -o $3 $DEPS $LDFLAGS
diff --git a/src/redo-ifcreate.c b/src/redo-ifcreate.c
new file mode 100644
index 0000000..71c9a22
--- /dev/null
+++ b/src/redo-ifcreate.c
@@ -0,0 +1,17 @@
+/* redo-ifcreate.c
+ *
+ * Copyright (c) 2014 Tharre
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+#include "build.h"
+
+int main(int argc, char *argv[]) {
+ for (int i = 1; i < argc; ++i) {
+ if (has_changed(argv[i], 'e', false))
+ build_target(argv[i]);
+ add_dep(argv[i], 'e');
+ }
+}