6 cat Makefile.base
> Makefile
7 printf "\n" >> Makefile
8 for folder
in `find . -path ./obj -prune -o -type d -print`; do
12 sources
=`find . -type f -name \*.c`
14 for file in $sources; do
15 objects
+="obj/${file%?}o "
17 printf "obj/\$(TARGET): $objects\n" >> Makefile
18 printf '\t$(CC) $(LDFLAGS) -o $@ $^\n\n' >> Makefile
20 for file in $sources; do
21 deps
=`grep '#include "' $file | cut -d ' ' -f 2 | sed 's/^"\(.*\)"$/..\/\1/g' | tr '\n' ' '`
22 fileDotO
="obj/${file%?}o"
23 printf "$fileDotO: $file $deps\n" >> Makefile
24 printf '\t$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<\n\n' >> Makefile