Chapter 16. Building Applications using ESQL

Table of Contents
Using ESQL with make
Additional command Line Interface Options
Redirecting ESQL Support output

Using ESQL with make

The program listing below shows a minimal Makefile which compile the source file nobel.gpq with embessed SQL code into a program with the name nobel_co (see samples/standalone).

Example 16-1. A minimal Makefile

   
ESQLFLAGS = $(DEBUG) -v -s -pedantic $(FLAGS)

# use always the local esql translator
ESQL=gesql

DBUSER=gnade
DBPASSWD=gnade
DBSOURCE=gnade

DBAUTH=  -DDBUSER=\"$(DBUSER)\" 		\
	 -DDBPASSWD=\"$(DBPASSWD)\" 		\
	 -DDBSOURCE=\"$(DBSOURCE)\"
##
## New compiler rule
##
.SUFFIXES: .adb .gpq

.gpq.adb:
	$(ESQL) $(ESQLFLAGS) $(DBAUTH) $*.gpq

all :: nobel_co

##
## nobel_co 
##
nobel.adb: nobel.gpq

nobel_co: nobel_co.adb nobel.adb nobel.ads
	gnatmake nobel_co -o nobel_co `gnade-config --libs` 

###
clean:
	rm -rf $(PROGRAMS) b~*.* *.o *.ali core *~ *~*~ bb.out 
	rm -rf nobel.adb