Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7933371
  • 博文数量: 124
  • 博客积分: 2880
  • 博客等级: 少校
  • 技术积分: 873
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-16 17:08
文章分类

全部博文(124)

文章存档

2011年(28)

2010年(60)

2009年(36)

我的朋友

分类: C/C++

2011-10-13 17:51:34


#AIX操作系统
#CC = xlc_r
#LINUX操作系统
#CC = gcc
#SCO UNIX操作系统
#CC = cc
#DEV_HOME = /app/etcdev/dev_unix
OSTYPE=`uname`
OBJPATH = $(DEV_HOME)/obj
LIBPATH = $(DEV_HOME)/lib
BINPATH = $(DEV_HOME)/bin
SBINPATH = $(DEV_HOME)/sbin
BNDPATH = $(DEV_HOME)/bnd
CONFPATH = $(DEV_HOME)/conf
LOGPATH = $(DEV_HOME)/log
SRCPATH = $(DEV_HOME)/src
INCPATH = $(SRCPATH)/include
DB2INSTPATH = /app/gsgl

INCLUDES = -I$(DB2INSTPATH)/sqllib/include -I$(INCPATH)
LIBS = -L$(DB2INSTPATH)/sqllib/lib -ldb2 -L$(LIBPATH) -lxtools -ldb2comm
ONLIBS = $(LIBPATH)/libxtools.a $(LIBPATH)/libdb2comm.a
# SCO编译时需要的单独编译选项
LIBS_SCO = -dy $(LIBS) -lsocket
# 为了SCO的条件编译
CFLAGS_SCO = -D SCO_SV
OBJS = toll_cbl2.o \
    pos_cbl_get.o \
    toll_cbl2_put.o \
    param_serv_conf.o \
    param_mesg.o \
    paraverinfo.o \
    pos_toll.o
OBJS1 = toll_cbl2.o \
    pos_cbl_get.o \
    toll_cbl2_put.o \
    param_serv_conf.o \
    param_mesg.o \
    paraverinfo.o \
    pos_toll.o
OBJS2 = toll_cbl2.o \
    param_serv_conf.o \
    param_mesg.o \
    paraverinfo.o
OBJS3 = toll_cbl2.o \
    param_serv_conf.o \
    param_mesg.o \
    paraverinfo.o
BINNAME1 = top_param_serv
BINNAME2 = param_udp_serv
BINNAME3 = top_cbl_cbl2
all: help
#$(BINNAME1) \
#$(BINNAME2) \
#$(BINNAME3)
#   top_cbl2_refresh \
#   top_cbl_cbl2 \
#   top_cbl2_init
#本地数据库用户名和密码
DBNAME=db_toll
USER=gsgl
PSWD=gsgl123
#客服数据库db_pos本地客户端,需要从该数据库同步数据
DBNAME_POS=dot4_pos
USER_POS=gsgl
PSWD_POS=gsgl123
########################################################

# 收费站,支持SCO和Linux,AIX操作系统
tg:
    @if [ "$(OSTYPE)" = "SCO_SV" ];then make param_udp_serv_sco;else make param_udp_serv;fi
    #make param_udp_serv
# 结算中心
top:
    make param_udp_serv
    make top_param_serv
    make top_cbl_cbl2
help:
    @echo ""
    @echo "    收费站请使用命令: make tg"
    @echo "    结算中心使用命令: make top"
    @echo ""

########################################################
toll_cbl2.o: toll_cbl2.sqc
#   $(SBINPATH)/embprep toll_cbl2 $(DBNAME) $(USER) $(PSWD)
    db2 connect to $(DBNAME) user $(USER) using $(PSWD)
    db2 prep toll_cbl2.sqc bindfile BLOCKING ALL DATETIME ISO queryopt 9 PACKAGE USING TOP_CBL2
    #db2 prep toll_cbl2.sqc bindfile BLOCKING ALL INSERT BUF DATETIME ISO queryopt 9 LONGERROR NO PACKAGE USING TOP_CBL2
    $(CC) -o toll_cbl2.o -c toll_cbl2.c $(INCLUDES)
    db2 connect reset
    rm -f toll_cbl2.c
    mv toll_cbl2.bnd $(BNDPATH)
toll_cbl2_put.o: toll_cbl2_put.sqc
    $(SBINPATH)/embprep toll_cbl2_put $(DBNAME) $(USER) $(PSWD)
    $(CC) -o toll_cbl2_put.o -c toll_cbl2_put.c $(INCLUDES)
    rm -f toll_cbl2_put.c
    mv toll_cbl2_put.bnd $(BNDPATH)
pos_cbl_get.o: pos_cbl_get.sqc
    $(SBINPATH)/embprep pos_cbl_get $(DBNAME_POS) $(USER_POS) $(PSWD_POS)
    $(CC) -o pos_cbl_get.o -c pos_cbl_get.c $(INCLUDES)
    rm -f pos_cbl_get.c
    mv pos_cbl_get.bnd $(BNDPATH)

paraverinfo.o: paraverinfo.sqc
    $(SBINPATH)/embprep paraverinfo $(DBNAME) $(USER) $(PSWD)
    $(CC) -o paraverinfo.o -c paraverinfo.c $(INCLUDES)
    rm -f paraverinfo.c
    mv paraverinfo.bnd $(BNDPATH)
########################################################
pos_toll.o: pos_toll.c
    $(CC) -o pos_toll.o -c pos_toll.c $(INCLUDES)
param_serv_conf.o: param_serv_conf.c
    $(CC) -o param_serv_conf.o -c param_serv_conf.c $(INCLUDES)
param_mesg.o: param_mesg.c
    $(CC) -o param_mesg.o -c param_mesg.c $(INCLUDES)
########################################################
top_param_serv: $(OBJS1) $(ONLIBS)
    $(CC) -o top_param_serv top_param_serv.c $(OBJS1) $(INCLUDES) $(LIBS)
    @mv top_param_serv $(BINPATH)/$(BINNAME)
    @cp paramserv.conf $(CONFPATH)
    @cp sendto_hosts.conf $(CONFPATH)
    @cp bindparam $(SBINPATH)
    @cp bindtop $(SBINPATH)
    @cp bindparam $(BNDPATH)
    @cp bindtop $(BNDPATH)
    @cp param_top $(BINPATH)
param_udp_serv:  $(OBJS2) param_udp_serv.c
    $(CC) -o param_udp_serv param_udp_serv.c $(OBJS2) $(INCLUDES) $(LIBS)
    @mv param_udp_serv $(BINPATH)
    @cp paramserv.conf $(CONFPATH)
    @cp sendto_hosts.conf $(CONFPATH)
    @cp bindparam $(SBINPATH)
    @cp bindtg $(SBINPATH)
    @cp bindparam $(BNDPATH)
    @cp bindtg $(BNDPATH)
    @cp param_tg $(BINPATH)

param_udp_serv_sco:  $(OBJS2) param_udp_serv.c
    $(CC) -o param_udp_serv param_udp_serv.c $(CFLAGS_SCO) $(OBJS2) $(INCLUDES) $(LIBS_SCO)
    @mv param_udp_serv $(BINPATH)
    @cp paramserv.conf $(CONFPATH)
    @cp sendto_hosts.conf $(CONFPATH)
    @cp bindparam $(SBINPATH)
    @cp bindtg $(SBINPATH)
    @cp bindparam $(BNDPATH)
    @cp bindtg $(BNDPATH)
    @cp param_tg $(BINPATH)
 
top_cbl2_refresh: $(OBJS) $(ONLIBS)
    $(CC) -o top_cbl2_refresh top_cbl2_refresh.c $(OBJS) $(INCLUDES) $(LIBS)
    @mv top_cbl2_refresh $(BINPATH)/top_cbl2_refresh
top_cbl_cbl2: $(OBJS3) $(ONLIBS)
    $(CC) -o top_cbl_cbl2 top_cbl_cbl2.c $(OBJS3) $(INCLUDES) $(LIBS)
    @mv top_cbl_cbl2 $(BINPATH)/top_cbl_cbl2
top_cbl2_init: $(OBJS) $(ONLIBS)
    $(CC) -o top_cbl2_init top_cbl2_init.c $(OBJS) $(INCLUDES) $(LIBS)
    @mv top_cbl2_init $(BINPATH)/top_cbl2_init
########################################################
test_1.o: test_1.sqc
    $(SBINPATH)/embprep test_1 $(DBNAME_POS) $(USER_POS) $(PSWD_POS)
    $(CC) -o test_1.o -c test_1.c $(INCLUDES) $(LIBS)
    rm -f test_1.c
    mv test_1.bnd $(BNDPATH)
tt_1: tt_1.c test_1.o
    $(CC) -o tt_1 tt_1.c test_1.o $(INCLUDES) $(LIBS)
    mv tt_1 $(BINPATH)/
tt_2: tt_2.c
    $(CC) -o tt_2 tt_2.c $(INCLUDES) $(LIBS)
########################################################
########################################################

clean:
    rm -f ./*.o  $(BNDPATH)/*
    rm -f $(BINPATH)/* $(LOGPATH)/* $(CONFPATH)/*
    rm -f tt_[0-9] tt_[0-9][0-9]
阅读(3458) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~