make Questions

By olive - November 15, 20113 Answers

Hello, I got stuck in a make file which I doubt I didn't use vpath correctly. I came across your article here and I can figure that you are knowledgable about this. Is it possible you do me a favor?
I have a simple make file like this:

vpath %.c ${WPCP}:${CPCP}
vpath %.pc ${WPGM}:${CPGM}
vpath %.o $(WOBJ):$(COBJ)

PCCFLAGS = maxopencursors=30 \
sqlcheck=semantics \
userid=$(USERID) \
code=ansi_c mode=oracle ltype=none \
include=$(WINC) include=$(CINC) \
include=$(ORACLE_HOME_DTB)/rdbms/public \
$(DEBUGPL)

foo.c: foo.pc
proc $(PCCFLAGS) oname=${WPCP}/$*.c iname=$<;\

CFLAG = $(DBG) $(DEBUG) \
$(ICIS_CC_OPT) \
-I $(WINC) -I $(CINC) \
-I$(ORACLE_HOME_DTB)/rdbms/demo \
-I$(ORACLE_HOME_DTB)/rdbms/public \
-I$(ORACLE_HOME_DTB)/precomp/public \
$(C64BIT:64=-q64)
foo.o: foo.c
$(CC) $(CFLAG) -fPIC -c $< -o ${WOBJ}/$*.o

If I make foo.c, then make foo.o (in two separate steps), it works fine.

But if I directly make foo.o, it says foo.c not found after foo.c is actually generated.

And, if I am in the directory where .c should be, then, make foo.o also works. But if I am not in that directory, then cc complains that foo.c doesn't exist if I directly make foo.o. So it seems cc cannot search foo.c in vpath?

Thank you in advance.

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.