# -*-makefile-*----------------------------------------------------------------
# $Id: demos.in,v 1.2 2004/06/02 04:34:49 aroach Exp $
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 22-Jul-1994
#
# PLplot demo file dependencies and targets.
# 
# Targets supported here include: 
#
#	cdemos		All the C demos
#	fdemos		All the Fortran demos
#	tkdemos		All the extended wish (TK) demos
#	x??[cf]		Demo number ??, C or fortran versions
#	xtk??		Demo number ??, extended wish versions
#
# Notes:
#  - To aid in development, additional dependencies (autogenerated) are
#    included at the end of the makefile.
#  - Explicit rules are specified for object file generation so that the
#    rules for building a shared library don't get in the way.
#  - CC_FLAGS_DEMOS and CXX_FLAGS_DEMOS were created to contain the extra
#    include file directives needed in the standalone demo makefile.
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Example programs, in C.

CDEMOS= x01c$E x02c$E x03c$E x04c$E x05c$E x06c$E x07c$E x08c$E x09c$E \
	x10c$E x11c$E x12c$E x13c$E x14c$E x15c$E x16c$E x17c$E x18c$E \
	x19c$E x20c$E x21c$E x22c$E tutor$E

cdemos:	$(CDEMOS)

cdemo_objs := $(CDEMOS: tutor$E=)
cdemo_objs := $(cdemo_objs:$E=$O)

ifdef compile-c-and-emit-deps
# Hmm, $* seems to be behaving strangely...
$(cdemo_objs) : x%c$O : x%c.c
	$(call compile-c-and-emit-deps,$(CC_FLAGS_DEMOS),x$*c,$@)
else
x01c$O: x01c.c
	$(CC) $(CC_FLAGS_DEMOS) x01c.c
x02c$O: x02c.c
	$(CC) $(CC_FLAGS_DEMOS) x02c.c
x03c$O: x03c.c
	$(CC) $(CC_FLAGS_DEMOS) x03c.c
x04c$O: x04c.c
	$(CC) $(CC_FLAGS_DEMOS) x04c.c
x05c$O: x05c.c
	$(CC) $(CC_FLAGS_DEMOS) x05c.c
x06c$O: x06c.c
	$(CC) $(CC_FLAGS_DEMOS) x06c.c
x07c$O: x07c.c
	$(CC) $(CC_FLAGS_DEMOS) x07c.c
x08c$O: x08c.c
	$(CC) $(CC_FLAGS_DEMOS) x08c.c
x09c$O: x09c.c
	$(CC) $(CC_FLAGS_DEMOS) x09c.c
x10c$O: x10c.c
	$(CC) $(CC_FLAGS_DEMOS) x10c.c
x11c$O: x11c.c
	$(CC) $(CC_FLAGS_DEMOS) x11c.c
x12c$O: x12c.c
	$(CC) $(CC_FLAGS_DEMOS) x12c.c
x13c$O: x13c.c
	$(CC) $(CC_FLAGS_DEMOS) x13c.c
x14c$O: x14c.c
	$(CC) $(CC_FLAGS_DEMOS) x14c.c
x15c$O: x15c.c
	$(CC) $(CC_FLAGS_DEMOS) x15c.c
x16c$O: x16c.c
	$(CC) $(CC_FLAGS_DEMOS) x16c.c
x17c$O: x17c.c
	$(CC) $(CC_FLAGS_DEMOS) x17c.c
x18c$O: x18c.c
	$(CC) $(CC_FLAGS_DEMOS) x18c.c
x19c$O: x19c.c
	$(CC) $(CC_FLAGS_DEMOS) x19c.c
x20c$O: x20c.c
	$(CC) $(CC_FLAGS_DEMOS) x20c.c
x21c$O: x21c.c
	$(CC) $(CC_FLAGS_DEMOS) x21c.c
x22c$O: x22c.c
	$(CC) $(CC_FLAGS_DEMOS) x22c.c

endif

x01c$E:	$(PLLIBS) x01c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x01c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x02c$E:	$(PLLIBS) x02c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x02c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x03c$E:	$(PLLIBS) x03c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x03c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x04c$E:	$(PLLIBS) x04c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x04c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x05c$E:	$(PLLIBS) x05c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x05c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x06c$E:	$(PLLIBS) x06c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x06c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x07c$E:	$(PLLIBS) x07c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x07c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x08c$E:	$(PLLIBS) x08c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x08c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x09c$E:	$(PLLIBS) x09c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x09c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x10c$E:	$(PLLIBS) x10c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x10c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x11c$E:	$(PLLIBS) x11c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x11c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x12c$E:	$(PLLIBS) x12c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x12c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x13c$E:	$(PLLIBS) x13c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x13c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x14c$E:	$(PLLIBS) x14c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x14c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x15c$E:	$(PLLIBS) x15c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x15c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x16c$E:	$(PLLIBS) x16c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x16c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x17c$E:	$(PLLIBS) x17c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x17c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x18c$E:	$(PLLIBS) x18c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x18c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x19c$E:	$(PLLIBS) x19c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x19c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x20c$E:	$(PLLIBS) x20c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x20c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x21c$E:	$(PLLIBS) x21c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x21c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

x22c$E:	$(PLLIBS) x22c$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) x22c$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

tutor$O: tutor.c
	$(CC) $(CC_FLAGS_DEMOS) tutor.c

tutor$E: $(PLLIBS) tutor$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) tutor$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

# Convenience rules for testing.

bugc$O:	bugc.c
	$(CC) $(CC_FLAGS_DEMOS) bugc.c

bugc$E:	$(PLLIBS) bugc$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) bugc$O \
	       $(PLLIB_LDC) $(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

# -----------------------------------------------------------------------------
# Example programs, in Fortran.

FDEMOS= x01f$E x02f$E x03f$E x04f$E x05f$E x06f$E x07f$E x08f$E x09f$E \
	x10f$E x11f$E x12f$E x13f$E x16f$E

fdemos:	$(FDEMOS)

x01f$O: x01f.f
	$(F77) $(F77_FLAGS) x01f.f

x01f$E:	$(PLLIBS) x01f$O
	$(LDF) $(LDF_FLAGS) x01f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x02f$O: x02f.f
	$(F77) $(F77_FLAGS) x02f.f

x02f$E:	$(PLLIBS) x02f$O
	$(LDF) $(LDF_FLAGS) x02f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x03f$O: x03f.f
	$(F77) $(F77_FLAGS) x03f.f

x03f$E:	$(PLLIBS) x03f$O
	$(LDF) $(LDF_FLAGS) x03f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x04f$O: x04f.f
	$(F77) $(F77_FLAGS) x04f.f

x04f$E:	$(PLLIBS) x04f$O
	$(LDF) $(LDF_FLAGS) x04f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x05f$O: x05f.f
	$(F77) $(F77_FLAGS) x05f.f

x05f$E:	$(PLLIBS) x05f$O
	$(LDF) $(LDF_FLAGS) x05f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x06f$O: x06f.f
	$(F77) $(F77_FLAGS) x06f.f

x06f$E:	$(PLLIBS) x06f$O
	$(LDF) $(LDF_FLAGS) x06f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x07f$O: x07f.f
	$(F77) $(F77_FLAGS) x07f.f

x07f$E:	$(PLLIBS) x07f$O
	$(LDF) $(LDF_FLAGS) x07f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x08f$O: x08f.f
	$(F77) $(F77_FLAGS) x08f.f

x08f$E:	$(PLLIBS) x08f$O
	$(LDF) $(LDF_FLAGS) x08f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x09f$O: x09f.f
	$(F77) $(F77_FLAGS) x09f.f

x09f$E:	$(PLLIBS) x09f$O
	$(LDF) $(LDF_FLAGS) x09f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x10f$O: x10f.f
	$(F77) $(F77_FLAGS) x10f.f

x10f$E:	$(PLLIBS) x10f$O
	$(LDF) $(LDF_FLAGS) x10f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x11f$O: x11f.f
	$(F77) $(F77_FLAGS) x11f.f

x11f$E:	$(PLLIBS) x11f$O
	$(LDF) $(LDF_FLAGS) x11f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x12f$O: x12f.f
	$(F77) $(F77_FLAGS) x12f.f

x12f$E:	$(PLLIBS) x12f$O
	$(LDF) $(LDF_FLAGS) x12f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x13f$O: x13f.f
	$(F77) $(F77_FLAGS) x13f.f

x13f$E:	$(PLLIBS) x13f$O
	$(LDF) $(LDF_FLAGS) x13f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

x16f$O: x16f.f
	$(F77) $(F77_FLAGS) x16f.f

x16f$E:	$(PLLIBS) x16f$O
	$(LDF) $(LDF_FLAGS) x16f$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

# Convenience rules for testing.

bugf$O:	bugf.f
	$(F77) $(F77_FLAGS) bugf.f

bugf$E:	$(PLLIBS) bugf$O
	$(LDF) $(LDF_FLAGS) bugf$O \
	       $(PLLIB_LDF) $(TO) $@ $(LDF_PATH) $(LDF_LIBS) $(DEMOS_RPATH)

# -----------------------------------------------------------------------------
# TK example programs.

TKDEMOS = xtk01$E xtk02$E xtk04$E

tkdemos: $(TKDEMOS)

xtk01$O: xtk01.c
	$(CC) $(CC_FLAGS_DEMOS) xtk01.c

xtk01$E:  $(PLLIBS) xtk01$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) xtk01$O \
	$(PLLIB_LDC) -l$(TCLLIB_NAME)$(LIB_TAG) \
	$(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

xtk02$O: xtk02.c
	$(CC) $(CC_FLAGS_DEMOS) xtk02.c

xtk02$E:  $(PLLIBS) xtk02$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) xtk02$O \
	$(PLLIB_LDC) -l$(TCLLIB_NAME)$(LIB_TAG) \
	$(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

xtk04$O: xtk04.c
	$(CC) $(CC_FLAGS_DEMOS) xtk04.c

xtk04$E:  $(PLLIBS) xtk04$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) xtk04$O \
	$(PLLIB_LDC) -l$(TCLLIB_NAME)$(LIB_TAG) \
	$(TO) $@ $(LDC_LIBS) $(DEMOS_RPATH)

# -----------------------------------------------------------------------------
# C++ example programs.

CXXDEMOS = x01cc$E

cxxdemos: $(CXXDEMOS)

x01cc$O: x01cc.cc
	$(CXX) $(CXX_FLAGS_DEMOS) x01cc.cc

x01cc$E:  $(PLLIBS) x01cc$O
	$(LDCXX) $(LDCXX_FLAGS) $(STARTUP) x01cc$O \
	       	$(PLLIB_LDCXX) $(TO) $@ $(LDCXX_LIBS) $(DEMOS_RPATH)

