##############################################################################
#           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
SHELL=/bin/sh

CPPEXAMPLES = rtgAnim

EXAMPLES = $(CPPEXAMPLES) $(CEXAMPLES)

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.
# LFLAGS = -L$(ALIAS_LOCATION)/ODS/OpenModel/lib
#
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.
#
rtgAnim:	rtgAnim.o
	$(CPLUSPLUS) $(LFLAGS) -o $@ rtgAnim.o $(CLIBS)


