subproject.sh (343B)
1 #!/bin/sh 2 3 die() 4 { 5 echo $@ 6 exit 7 } 8 9 NAME="${1:?"subproject's name must be provided on 1st arg"}" 10 test -e "$NAME" && die "$NAME already exists" 11 12 mkdir -p "$NAME/src" "$NAME/doc" 13 echo "subninja $NAME/$NAME.ninja" >> build.ninja 14 15 sed '/^PROJECT/ s!NAME!'"$NAME"'!g' template/_.ninja > "$NAME/$NAME.ninja" 16 cp template/_.cpp "$NAME/src/$NAME.cpp"