Search code examples
sqloracle-databasemakefileprocprecompile

Can I build my PC file (Oracle Pro*c) conditionally inside of my application's make file?


I'm attempting to combine my makefiles so I can simply build once and it will precompile the pc file completely before continuing to build the application. This should be possible but for the life of me I cannot figure it out. Here is my makefile (for redhat 7).

COMPILEDATE = $(shell date)
COMPILE=g++ -std=c++11 -Wall -Wuninitialized -g
OSTYPE = $(shell uname)
LIBDIR=../../lib/
INC=../../include/
FILES=myProcess
OBJS=   myProcess.o \
sqlStuff.o

O8P=$(ORACLE_HOME)
O8P=/u01/app/oracle/11.2.0/client_1
ORACLE_HOME=/u01/app/oracle/11.2.0/client_1
PROC_LINES=proc lines=yes code=ANSI_C iname=sqlStuff.pc parse=partial iname=sqlStuff include=. include=$(ORACLE_HOME)/precomp/public include=$(ORACLE_HOME)/rdbms/public include=$(ORACLE_HOME)/rdbms/demo include=$(ORACLE_HOME)/plsql/public include=$(ORACLE_HOME)/network/public

all: $(FILES)

compileInfo.o : FORCE
    $(COMPILE) -c compileInfo.cpp -o $@ -I$(INC)  -DCDATE="\"$(COMPILEDATE)\"" -DBUILD="\"$(LSWBUILD)\""

FORCE : 

%.o : %.cpp $(INC)myProcess.h
$(COMPILE) -c $< -o $@ -I$(INC)  -DCDATE="\"$(COMPILEDATE)\""

sqlStuff.o : sqlStuff.c
    gcc -g -Wall -O -c -lclntsh -I. -I$(ORACLE_HOME)/precomp/public -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/plsql/lib -I$(ORACLE_HOME)/network/lib   

sqlStuff.c : sqlStuff.pc
    $(PROC_LINES)

myProcess: $(OBJS) $(LIBDIR)libbase.a $(INC)myProcess.h sqlStuff.o
    $(COMPILE) -o myProcess$(OBJS) -L$(LIBDIR) -lbase

clean:
rm -f $(FILES)
rm -f sqlStuff
rm -f sqlStuff.c
rm -f sqlStuff.lis
rm -f $(OBJS)
rm -f core
rm -f *.out
rm -f *.log
rm -f *.err

My fault, I didn't explain what the issue was:

I'm compiling in netbeans using this build command: ${MAKE} -f Makefile. The error is PCC-S-02015, unable to open include file on my object that is not being precompiled, sqlStuff.o


Solution

  • Looking at the gcc command under sqlStuff.o : sqlStuff.c, it looks to me that there should be a -o sqlStuff.o flag to tell gcc that the output should be written to sqlStuff.o instead of the default, which is a.out.

    Best of luck.