Makefile with Pro*C cannot find .c file

600 Views Asked by At

I have a directory of .pc files, and I am trying to compile to .o files with a Makefile. Oracle Pro*C precompiles the .pc files into .c. Then gcc compiles the .c files to .o. These are the rules:

%.c: %.pc
    $(PROC) $(PROCPLSFLAGS)  INCLUDE=$(SRCHOME) iname=$<
%.o: %.c 
    $(CC) $(INCLUDE) $(CFLAGS) $(PRECOMPPUBLIC) -c $<

The problem occurs when I try to build a .o file. The .c file is generated correctly, but the $(CC) line cannot find the .c file until I run make a second time. When I run the Makefile without any arguments to build the entire directory, I need to run make twice for each .pc file in the directory. How can I fix the Makefile so that it only needs to run once?

0

There are 0 best solutions below