gnu make:无法理解为什么找不到我的隐式

时间:2018-06-25 09:23:40

标签: gnu-make cobol

我正在尝试使用自己的隐式规则编译cobol源,但没有成功。

上下文:

  1. AIX上的GNU make 3.81
  2. Cobol源文件位于源目录中,而编译后的文件位于另一个目录中
  3. Cobol源文件扩展名为.cbl,已编译文件没有扩展名,即AZ0001.cbl在编译时变为AZ0001

这是我的Makefile:

COBFLAGS=-g -qTEST -q"SPILL(32648)" -q64 -q"WSCLEAR(32)" -qNOSEQ -qLIST -qNUMBER -qSSRANGE -q"LINECOUNT(0)"
SRCDIR=../../ai_cobol/src/main/cbl/lib
CPYDIR=../../ai_cobol/src/main/cpy
TMPCBL=/tmp/tmpcbl

vpath %.cbl $(SRCDIR)

SOURCES = $(wildcard $(SRCDIR)/*.cbl)
CIBLES = $(notdir $(SOURCES))

.SUFFIXES: .cbl

% : %.cbl
        cob2 $(COBFLAGS) -I$(CPYDIR) $< $(ZZDEBUG)

all: init todo

init:
        rm -rf $(TMPCBL) && mkdir -p $(TMPCBL)

todo: $(CIBLES)
        echo ""

启动Gmake从未构建过我的cobol源文件。但是,调试输出显示gmake可以找到它们:

....
Considering target file `ZZABEND.cbl'.
 Looking for an implicit rule for `ZZABEND.cbl'.
 Trying pattern rule with stem `ZZABEND.cbl'.
 Trying implicit prerequisite `ZZABEND.cbl,v'.
 Trying pattern rule with stem `ZZABEND.cbl'.
 Trying implicit prerequisite `RCS/ZZABEND.cbl,v'.
 Trying pattern rule with stem `ZZABEND.cbl'.
 Trying implicit prerequisite `RCS/ZZABEND.cbl'.
 Trying pattern rule with stem `ZZABEND.cbl'.
 Trying implicit prerequisite `s.ZZABEND.cbl'.
 Trying pattern rule with stem `ZZABEND.cbl'.
 Trying implicit prerequisite `SCCS/s.ZZABEND.cbl'.
 No implicit rule found for `ZZABEND.cbl'.
 Finished prerequisites of target file `ZZABEND.cbl'.
No need to remake target `ZZABEND.cbl'; using VPATH name `../../ai_cobol/src/main/cbl/lib/ZZABEND.cbl'.
Considering target file `ZZASBTPB.cbl'.
 Looking for an implicit rule for `ZZASBTPB.cbl'.
 Trying pattern rule with stem `ZZASBTPB.cbl'.
 Trying implicit prerequisite `ZZASBTPB.cbl,v'.
 Trying pattern rule with stem `ZZASBTPB.cbl'.
 Trying implicit prerequisite `RCS/ZZASBTPB.cbl,v'.
 Trying pattern rule with stem `ZZASBTPB.cbl'.
 Trying implicit prerequisite `RCS/ZZASBTPB.cbl'.
 Trying pattern rule with stem `ZZASBTPB.cbl'.
 Trying implicit prerequisite `s.ZZASBTPB.cbl'.
 Trying pattern rule with stem `ZZASBTPB.cbl'.
 Trying implicit prerequisite `SCCS/s.ZZASBTPB.cbl'.
 No implicit rule found for `ZZASBTPB.cbl'.
 Finished prerequisites of target file `ZZASBTPB.cbl'.
No need to remake target `ZZASBTPB.cbl'; using VPATH name `../../ai_cobol/src/main/cbl/lib/ZZASBTPB.cbl'.
 ......

所以我不明白鲸鱼是问题所在.....

1 个答案:

答案 0 :(得分:1)

您的'CIBLES'包含源文件的名称;尝试此更改:

old: CIBLES = $(notdir $(SOURCES))
new: CIBLES = $(basename $(notdir $(SOURCES)))