added the make package target. Builds a faxien style package.
[otp-base.git] / tools / utilities / application_generator
blob7e0077e59a55391de6f342d39e0d10472d0492c5
1 #!/bin/sh
3 cd $(dirname $0)
6 if [ "$#" != "2" ];then
7 echo ""
8 echo "usage: $0 <appname> <prefix>"
9 echo ""
10 echo "appname is the title of the application to be generated"
11 echo "prefix is the prefix that will be appended to all files in"
12 echo "the application due to erlangs lack of a package structure. The prefix"
13 echo "is typicaly the first letter of each word in the name of the application"
14 echo ""
15 echo "example: $0 chat_server cs"
16 echo ""
17 exit 1
20 APP_NAME=$1
21 APP_NAME_UPPER_CASE=$(echo $APP_NAME | tr a-z A-Z)
22 PREFIX=$2
24 if [ -e ../../lib/$APP_NAME ];then
25 echo "an application with name $APP_NAME already exists would you like to delete it [y|N] $> \c"
26 read DEL
27 if [ "$DEL" != "y" ];then
28 echo "aborting application creation"
29 exit 1
31 echo "deleting $APP_NAME"
32 rm -rf ../../lib/$APP_NAME
36 cd ../.appgen
37 echo `pwd`
39 cp -r blank_app $APP_NAME
41 cd $APP_NAME/src
42 ls ba* | ../../rename.sh ba $PREFIX
43 ls blank_app* | ../../rename.sh blank_app $APP_NAME
44 cd -
46 # The base directory of the application
47 ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/Makefile
48 ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/vsn.mk
50 # The src directory of the application
51 ./substitute.sh %%APP_NAME%% $APP_NAME $APP_NAME/src/Makefile
52 ./substitute.sh %%APP_NAME_UPPER_CASE%% $APP_NAME_UPPER_CASE $APP_NAME/src/Makefile
53 ./substitute.sh %%PFX%% $PREFIX $APP_NAME/src/Makefile
55 # include directory
56 mv $APP_NAME/include/blank_app.hrl $APP_NAME/include/"$APP_NAME".hrl
58 mv $APP_NAME ../../lib
60 echo ""
61 echo "$APP_NAME has been generated and placed under lib/$APP_NAME"
62 echo ""
64 cd ../utilities