[sms@db templet]$
[sms@db templet]$ cat compilation.sh
#!/bin/sh
source /etc/profile
source ~/.bash_profile
find ./ -empty -exec rm -rf {} \;
rm -rf procmain.c
proc procmain.pc
gcc -o procmain procmain.c -I $ORACLE_HOME/precomp/public -L $ORACLE_HOME/lib -l clntsh
find ./ -empty -exec rm -rf {} \;
[sms@db templet]$ sh compilation.sh
Pro*C/C++: Release 10.2.0.1.0 - Production on Fri Nov 1 15:51:09 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /u01/app/oracle/product/10.2.0/client_1/precomp/admin/pcscfg.cfg
[sms@db templet]$
更新一个版本
[sms@db templet]$ cat compilation.sh
#!/bin/sh
. /etc/profile
. ~/.bash_profile
build(){
find ./ -empty -exec rm -rf {} \;
dos2unix *.*
rm -rf procmain.c
#proc procmain.pc
proc iname=procmain.pc oname=procmain.c parse=full include=$ORACLE_HOME/precomp/public include=/usr/lib sqlcheck=syntax
gcc $1 procmain procmain.c -I $ORACLE_HOME/precomp/public -L $ORACLE_HOME/lib -l clntsh
find ./ -empty -exec rm -rf {} \;
}
###########################################################################
# BEGINNING OF MAIN
###########################################################################
THE_DATE=`date +"%Y-%m-%d %H:%M:%S"`
echo "[$THE_DATE]:Begin $1 ......"
case "$1" in
debug)
build " -g -o "
;;
build)
build " -o "
;;
*)
echo $"Usage: $0 {debug|build}"
exit 1
esac
THE_DATE1=`date +"%Y-%m-%d %H:%M:%S"`
echo "[$THE_DATE1]:End $1 ......"
[sms@db templet]$ sh compilation.sh build
[2013-11-04 16:14:08]:Begin build ......
dos2unix: converting file cls.conf to UNIX format ...
dos2unix: converting file compilation.sh to UNIX format ...
dos2unix: converting file gettime.c to UNIX format ...
dos2unix: converting file mytimes.c to UNIX format ...
dos2unix: converting file procmain.c to UNIX format ...
dos2unix: converting file procmain.pc to UNIX format ...
dos2unix: converting file procmain_test.c to UNIX format ...
dos2unix: converting file procmain_test.pc to UNIX format ...
dos2unix: converting file readconf.c to UNIX format ...
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Nov 4 16:14:08 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /u01/app/oracle/product/10.2.0/client_1/precomp/admin/pcscfg.cfg
[2013-11-04 16:14:09]:End build ......
[sms@db templet]$ ./procmain
You must input config file!
eg:./procmain config_file_name.conf
[sms@db templet]$
[sms@db templet]$ cat compilation.sh
#!/bin/sh
. /etc/profile
. ~/.bash_profile
build(){
find ./ -empty -exec rm -rf {} \;
dos2unix *.*
rm -rf procmain.c
#proc procmain.pc
#proc iname=procmain.pc oname=procmain.c parse=full include=$ORACLE_HOME/precomp/public include=$ORACLE_HOM/rdbms/public include=/usr/lib sqlcheck=full userid=ydqxn/ydqxn@ydqx
proc iname=procmain.pc oname=procmain.c parse=full include=$ORACLE_HOME/rdbms/public include=$ORACLE_HOME/precomp/public include=/usr/lib
echo "============================================================================"
echo "end proc "
echo "============================================================================"
gcc $1 procmain procmain.c -I $ORACLE_HOME/rdbms/public -I $ORACLE_HOME/precomp/public -L $ORACLE_HOME/lib -l clntsh
echo "============================================================================"
echo "end gcc"
echo "============================================================================"
find ./ -empty -exec rm -rf {} \;
}
###########################################################################
# BEGINNING OF MAIN
###########################################################################
THE_DATE=`date +"%Y-%m-%d %H:%M:%S"`
echo "[$THE_DATE]:Begin $1 ......"
case "$1" in
debug)
build " -g -o "
;;
build)
build " -o "
;;
*)
echo $"Usage: $0 {debug|build}"
exit 1
esac
THE_DATE1=`date +"%Y-%m-%d %H:%M:%S"`
echo "[$THE_DATE1]:End $1 ......"
[sms@db templet]$ sh compilation.sh build
[2013-11-11 11:16:24]:Begin build ......
dos2unix: converting file bakprocmain.pc to UNIX format ...
dos2unix: converting file cls.conf to UNIX format ...
dos2unix: converting file compilation.sh to UNIX format ...
dos2unix: converting file gettime.c to UNIX format ...
dos2unix: converting file mytimes.c to UNIX format ...
dos2unix: converting file procmainbak20131111.pc to UNIX format ...
dos2unix: converting file procmain.c to UNIX format ...
dos2unix: converting file procmain.pc to UNIX format ...
dos2unix: converting file procmain_test.c to UNIX format ...
dos2unix: converting file procmain_test.pc to UNIX format ...
dos2unix: converting file readconf.c to UNIX format ...
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Nov 11 11:16:24 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /u01/app/oracle/product/10.2.0/client_1/precomp/admin/pcscfg.cfg
============================================================================
end proc
============================================================================
============================================================================
end gcc
============================================================================
[2013-11-11 11:16:25]:End build ......
[sms@db templet]$
因为还没有学会写makefile,暂时写了个shell来集成一下命令编译pro*c代码。