欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

pro*cobol编译用Makefile

程序员文章站 2022-05-19 18:48:21
...

下面是我自做的pro*cobol + micro focus cobol编译用makefile

 

1. 共通定义common.mak

export COBCPY=../cpycom
export COBIDY=../../obj

DBCONN = xxx/xxx@orclxx'

COB = cob64
PROCOB = $(ORACLE_HOME)/bin/procob

RM = rm -f
MV = mv
CP = cp

CPYDIR = ../cpyxx
APLLIBDIR = ../../lib

OBJDIR = ../../obj
EXEDIR = ../../bin
SODIR = ../../lib

SRCDIR = ../

PROCFLAGS = dbms=v8 ireclen=500 maxliteral=132 oreclen=500 sqlcheck=full \
			userid=$(DBCONN) unsafe_null=yes common_parser=yes

ifdef SBITC
	CFLAGS = -z -C "TESTCOVER" -c -P COPYEXT"(cpy,CPY,cbl)"
else
	CFLAGS = -z  -c -P COPYEXT"(cpy,CPY,cbl)"
endif
	
SO_LINKFLAGS = -z  -L$(APLLIBDIR)
EXE_LINKFLAGS = -x -L$(APLLIBDIR) -L$(ORACLE_HOME)/lib

 

2. pro*cobol 的so文件编译Makefile如下

EXE  = $(SODIR)/lib$(PROG).so
OBJS = $(OBJDIR)/$(PROG).o

GEN_FILES = $(PROG).o $(PROG).idy $(PROG).int $(PROG).lst

all : $(EXE)

$(EXE) : $(OBJS)
	$(COB) -o $@ $(SO_LINKFLAGS) $(OBJS) $(LIBS)

$(OBJS) : $(OBJDIR)/$(PROG).cob
	$(COB) -o $@ $(CFLAGS) $<
	$(MV) $(GEN_FILES) $(OBJDIR)/

$(OBJDIR)/$(PROG).cob : $(PROG).pco
	$(PROCOB) $(PROCFLAGS) include=$(COBCPY) iname=$< oname=$@ lname=$(OBJDIR)/$(PROG).lis

clean:
	cd $(OBJDIR); $(RM) $(GEN_FILES); $(RM) $(PROG).cob $(PROG).lis
	$(RM) $(EXE)
	$(RM) $(OBJS)
	$(RM) $(GEN_FILES)

 3. pro*cobol的可执行程序Makefile如下

EXE = $(EXEDIR)/$(PROG)
OBJS = $(OBJDIR)/$(PROG).o

LIBS += -lclntsh $(ORACLE_HOME)/precomp/lib/cobsqlintf.o
GEN_FILES = $(PROG).o $(PROG).idy $(PROG).int $(PROG).lst

all : $(EXE)

$(EXE) : $(OBJS)
	$(COB) -o $@ $(EXE_LINKFLAGS) $(OBJS) $(LIBS)

$(OBJS) : $(OBJDIR)/$(PROG).cob
	$(COB) -o $@ $(CFLAGS) $<
	$(MV) $(GEN_FILES) $(OBJDIR)/

$(OBJDIR)/$(PROG).cob : $(PROG).pco
	$(PROCOB) $(PROCFLAGS) include=$(COBCPY) iname=$< oname=$@ lname=$(OBJDIR)/$(PROG).lis

clean:
	cd $(OBJDIR); $(RM) $(GEN_FILES); $(RM) $(PROG).cob $(PROG).lis
	$(RM) $(EXE)
	$(RM) $(OBJS)
	$(RM) $(GEN_FILES)

 3. micro focus cobol 的so文件编译Makefile

EXE  = $(SODIR)/lib$(PROG).so
OBJS = $(OBJDIR)/$(PROG).o

GEN_FILES = $(PROG).o $(PROG).idy $(PROG).int $(PROG).lst

all : $(EXE)

$(EXE) : $(OBJS)
	$(COB) -o $@ $(SO_LINKFLAGS) $(OBJS) $(LIBS)

$(OBJS) : $(PROG).cob
	$(COB) -o $@ $(CFLAGS) $<
	$(MV) $(GEN_FILES) $(OBJDIR)/


clean:
	cd $(OBJDIR); $(RM) $(GEN_FILES)
	$(RM) $(EXE)
	$(RM) $(OBJS)
	$(RM) $(GEN_FILES)

 

  4. micro focus cobol 的可执行文件编译Makefile

EXE = $(EXEDIR)/$(PROG)
OBJS = $(OBJDIR)/$(PROG).o

GEN_FILES = $(PROG).o $(PROG).idy $(PROG).int $(PROG).lst

all : $(EXE)

$(EXE) : $(OBJS)
	$(COB) -o $@ $(EXE_LINKFLAGS) $(OBJS) $(LIBS)

$(OBJS) : $(PROG).cob
	$(COB) -o $@ $(CFLAGS) $<
	$(MV) $(GEN_FILES) $(OBJDIR)/


clean:
	cd $(OBJDIR); $(RM) $(GEN_FILES)
	$(RM) $(EXE)
	$(RM) $(OBJS)
	$(RM) $(GEN_FILES)

 

相关标签: cobol