编译pro*c程序

31 篇文章 0 订阅
27 篇文章 0 订阅
[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代码。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

-无-为-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值