Replace Queue List internal usage by a Vector (lighter)
[cgds.git] / makeMakefile.sh
CommitLineData
a7868768
BA
1#!/usr/bin/bash
2
3subfolder=$1
4
5cd $subfolder
6cat Makefile.base > Makefile
7printf "\n" >> Makefile
8for folder in `find . -path ./obj -prune -o -type d -print`; do
9 mkdir -p obj/$folder
10done
11
12sources=`find . -type f -name \*.c`
13objects=""
14for file in $sources; do
15 objects+="obj/${file%?}o "
16done
17printf "obj/\$(TARGET): $objects\n" >> Makefile
18printf '\t$(CC) $(LDFLAGS) -o $@ $^\n\n' >> Makefile
19
20for 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
25done
26
27cd ..