Search code examples
gnu-makecobol

gnu make : doesn't understand why my implicit is never found


I'm trying to compile cobol sources using my own implicit rule without success.

Context :

  1. GNU make 3.81 on AIX
  2. Cobol source files are located in a source directory, while the compiled files are located to another one
  3. Cobol source file extension is .cbl, compiled file have no extension i.e AZ0001.cbl becomes AZ0001 when compiled

So here is my 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 ""

Launching Gmake never builts my cobol source files. However, debug output shows that gmake finds them:

....
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'.
 ......

So I don't understand whare is the problem.....


Solution

  • Your 'CIBLES' contains the names of the source-files; try this change:

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