1

I have an application which is running properly for Informix database. But now I want it to compile it for Oracle too. What changes should be made in the makefile shown below which is running properly for Informix?

ESQL:=esql
CFLAGS:=$(CFLAGS) -DSOLARIS
PROCFLAGS:=$(PROCFLAGS) -DSOLARIS
HEADERS= $(HOME)/tmiD/headers
target = $(HOME)
CC=gcc

%.o :%.ec ; $(ESQL) -I$(HEADERS) -c $(CFLAGS) -DINFORMIX -EDINFORMIX -I/usr/local/include $<

%.o :%.c ; $(CC) -I$(HEADERS) -c $(CFLAGS) $<

MAKEC= mv $(target)/$(@F) $(target)/$(@F).old; \
$(ESQL) -DINFORMIX -EDINFORMIX \
$^ $(CFLAGS) -lnsl -L $(target) \
-o $(target)/$(@F)

$(target)/%:%.o  $(CLIBFILES); $(MAKEC)
%:%.o  $(CLIBFILES); $(MAKEC)

all: a tw_interface clean

tw_interface: tcp.o trace.o global.o rmi.o License.o purge.o libswx.a

ap: tcp.o trace.o global.o rmi.o License.o purge.o

clean:
        -rm tcp.o trace.o global.o rmi.o purge.o License.o\
         trace.c global.c rmi.c
a:
        -rm tw_interface

I am very new to these things. So please help me.

Thank you in advance.

MK Singh
  • 706
  • 1
  • 13
  • 36
  • probably more things into `CFLAGS` – Basile Starynkevitch Sep 07 '12 at 05:17
  • Ok. I want to know what exactly needs to be done. Can you tell me that or give me any link that will be helpful? – MK Singh Sep 07 '12 at 05:38
  • 1
    Could you please edit your question to add any errors you get? If you do, then include _all_ errors, and do a copy/paste so you do not modify any of the messages. – Some programmer dude Sep 07 '12 at 05:46
  • As I had told, the makefile that I have given above is working completely fine with the Informix database without any errors. I want this thing to work for Oracle too. So I actually want to know what changes should be made in this make file. Please give me some information that what should be added/modified or removed from the above to make it work for Oracle. – MK Singh Sep 07 '12 at 06:14
  • I was able to compile for Oracle, but I am getting this error: "PCC-S-02015, unable to open include file" in the this line:"EXEC SQL include datetime;" What might have gone wrong and how to overcome it? – MK Singh Sep 10 '12 at 06:13

2 Answers2

0

Hmm....you say you're very new to these things.

Re-writing a Makefile is a non-trivial exercise, if you're not an experienced programmer.

But, if you want to give this a try, I recommend starting out by installing the Pro*C demos in your ORACLE_HOME. Once that's done, and you've verified it, by building the sample Pro*C programs, I recommend using the demo_proc.mk makefile, (which will be installed with the demo programs) as a template to convert the makefile.

Also, note, I don't know anything about Informix, but the code itself will probably need to be converted to Pro*C, as I assume Informix has some other precompiler, or alternate set of libraries for database access.

Hope that helps.

Mark J. Bobak
  • 13,720
  • 6
  • 39
  • 67
0

I think the Pro*C precompiler is invoked with "proc" so the first line

ESQL:=esql

should become

PRO_C:=proc

It looks like Pro*C files normally have a .pc file extension. Assuming your Pro*C files will be slightly different than your Informix *.es files, and you will create them with a .pc extension, then this line

%.o :%.ec ; $(ESQL) -I$(HEADERS) -c $(CFLAGS) -DINFORMIX -EDINFORMIX -I/usr/local/include $<

would become

%.o :%.pc ; $(PRO_C) CONFIG=proc_c_config.txt -I$(HEADERS) -c $(CFLAGS) -I/usr/local/include $<

The above line has "proc_c_config.txt" which is a file to create to put any desired Pro*C options. That part could be removed if there are no options desired other than defaults.

$(ESQL) -DINFORMIX -EDINFORMIX \

would become

$(PRO_C) CONFIG=pro_c_config.txt \

They talk about Pro*C options here

Scooter
  • 6,802
  • 8
  • 41
  • 64