##############################################################################
#           Makefile for use by API developers                               #
##############################################################################

#
# If the location of the Alias libraries and header files are
# different from $ALIAS_LOCATION, set it here.
#

ALIAS_LOCATION=/usr/aw/alias

CPPEXAMPLES = rtg_output

EXAMPLES = $(CPPEXAMPLES)

CC = cc
CPLUSPLUS = CC
INCLUDES = -I. -I$(ALIAS_LOCATION)/ODS/Common/include

#
# If you require the static library (libalias_api.a) rather than
# the dynamic library (libalias_api.so) use the following for
# LFLAGS.

#
# this is for static library:
# LFLAGS = -L$(ALIAS_LOCATION)/ODS/OpenModel/lib

#
# this is for dynamic library:
#
LFLAGS=-L$(ALIAS_LOCATION)/lib

#
# Note that with Alias V7.0 OpenModel is supplied as ELF
# static library and dynamic library (DSO).
#
LIBS = -lalias_api -lapi_memory -lapi_image -lm -lsun

CLIBS = $(LIBS)

#
# Some code is conditionally compiled because it produces a lot of output.
# (see AlPrint.c++ for example) Uncomment the following line if you would
# like to see all the output.
#
# COPIOUS_OUTPUT = -DCOPIOUS_OUTPUT

CFLAGS = -xansi -signed $(INCLUDES) $(COPIOUS_OUTPUT)
CPLUSPLUSFLAGS = $(CFLAGS)

#
# Rules for building.
#
.c++.o:
	$(CPLUSPLUS) -c $(CPLUSPLUSFLAGS) $*.c++

.c.o:
	$(CC) -c $(CFLAGS) $*.c

.o:
	$(CPLUSPLUS) $(LFLAGS) -o $@ $? $(CLIBS)

.c.i:
	 $(CC) -E $(CFLAGS) $*.c | sed -e '/^[    ]*$$/d' > $*.i

.c++.i:
	$(CPLUSPLUS) -E $(CPLUSPLUSFLAGS) $*.c++ | sed -e '/^[  ]*$$/d' > $*.i

#
# Build all the examples.
#
default: $(EXAMPLES)

#
# Clean up.
#
clean:
	rm *.o $(EXAMPLES)

#
# Rules for building the C++ executables.
#

rtg_output:			rtg_output.o
	$(CPLUSPLUS) $(LFLAGS) -o $@ fbAccess.o rtg_output.o $(CLIBS)


