Skip to content

Instantly share code, notes, and snippets.

@pyrtsa
Created July 8, 2011 12:49
Show Gist options
  • Save pyrtsa/1071745 to your computer and use it in GitHub Desktop.
Save pyrtsa/1071745 to your computer and use it in GitHub Desktop.
A redo file I've been using for my pet project
redo-ifchange env.sh && source env.sh
SRC=${1#"$BUILDDIR/"}
redo-ifchange "$SRC" # <- Mark the source (.cpp) dependency to Redo's database
$COMPILE -c "$SRC" -o "$3" $CXXFLAGS $INCLUDES -MMD -MF "$1.o.dep"
DEPS=""
while read -r line; do # Loop over all the header dependencies, and collect
line=${line#*:} # them as a list to $DEPS. There's no need (nor any
DEPS=$DEPS${line#%\\} # .do rule) to compile the headers, but redo-ifchange
done < "$1.o.dep" # records the dependency relation to Redo's database.
echo "${DEPS#*:}" | xargs redo-ifchange # Mark the header dependencies at once!
BUILDDIR="build"
# list of directories prefixed like "-Idir1 -Idir2"
INCLUDES="-Iinclude"
COMPILE="c++-4.6"
CXXFLAGS="-std=c++0x"
LINK=$COMPILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment