Skip to content

Instantly share code, notes, and snippets.

@rcfox
Created February 22, 2011 21:58
Show Gist options
  • Save rcfox/839506 to your computer and use it in GitHub Desktop.
Save rcfox/839506 to your computer and use it in GitHub Desktop.
# default.o.do
# apenwarr's version doesn't escape the slashes in the file name, so it doesn't work on subdirectories.
redo-ifchange $1.c
CFLAGS="..."
INCLUDE="..."
g++ $CFLAGS $INCLUDE -MD -MF $3.deps.tmp -c -o $3 $1.c
# Checks implicit dependencies
ESCAPED_FILE=$(echo "$3" | sed -e 's/\//\\\//g')
DEPS=$(sed -e "s/^$ESCAPED_FILE://" -e 's/\\//g' <$3.deps.tmp)
rm -f $3.deps.tmp
redo-ifchange $DEPS
#-----
# project.do
# Compiles all .c files into .o files, over all subdirectories except ./lib
# apenwarr would have you list all of the .o files manually
for file in `find . -name lib -prune -o -name '*.c' -print`; do
DEPS="$DEPS ${file%.c}.o ";
done
redo-ifchange $DEPS
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment