#!/bin/bash PREFIX=$HOME/share/ MAKEFILE_COMMON=$PREFIX # This program generates a project directory as a template for testing rpc # functionality # copy # configure # functions # Makefile.common # generate # sample .idl file with only comments # src directory # include directory # Makefile # src/Makefile PROJECT=$1 if [ -z "$1" ] then echo -e "You need to specifcy a project name" exit 1 fi if [ -f "$PROJECT" -o -d "$PROJECT" ] then echo -e "$PROJECT does already exists, please specify another name" exit 2 fi # ok, we can create a clean directory mkdir $PROJECT if [ ! -d "$PROJECT" ] then echo -e "Failed to create directory $PROJECT" exit 3 fi echo -e "Copying template directory to $PROJECT" cp -ar project/* $PROJECT echo -e "Cleaning up .svn entries" rm -rf $(find -L $PROJECT | grep \.svn$) 2>/dev/null #rmdir $(find -L $PROJECT | grep \.svn) echo -e "Generating project entries" sed -i "s/%PROJECT%/${PROJECT}/g" $PROJECT/Makefile sed -i "s/%PROJECT%/${PROJECT}/g" $PROJECT/src/Makefile sed -i "s/%PROJECT%/${PROJECT}/g" $PROJECT/configure echo -e "namespace $PROJECT" > $PROJECT/src/$PROJECT.idl echo -e "{" >> $PROJECT/src/$PROJECT.idl echo -e " class $PROJECT" >> $PROJECT/src/$PROJECT.idl echo -e " {" >> $PROJECT/src/$PROJECT.idl echo -e " };" >> $PROJECT/src/$PROJECT.idl echo -e "}" >> $PROJECT/src/$PROJECT.idl echo -e "Project generation complete" echo -e "Don't forget to configure first"