# -*-makefile-*----------------------------------------------------------------
# $Id: exes.in,v 1.1 2003/04/19 09:27:08 aroach Exp $
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 19-Jul-1994
#
# PLplot program file dependencies and targets.
# 
# Targets supported here include: 
#
#	plrender		Metafile viewer
#	pltek			Renderer for tek files
#	fonts			font generators and font files
#	pltcl			PLplot tcl interpreter (i.e. enhanced tclsh)
#	plserver		PLplot tcl/tk interpreter (i.e. enhanced wish).
#				Handles plplot Tk driver rendering.
#	plplotcmodule		Dynamically loaded module for PLplot python scripts
#	plplot_widgetmodule	Dynamically loaded module used by PLplot python widgets
#
#
# All but "fonts" are in the default build rule.
# Note: the portable font files are supplied in the distribution
# and normally do not need to be rebuilt.
# -----------------------------------------------------------------------------

# Utility programs.

pltek$E:	pltek$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) pltek$O $(TO) $@ $(RPATH)

# This is what the pltek build rule used to be, but it's wrong, b/c
# pltek doesn't need to link with tk, tcl, X11, etc.  Should make a
# new macro for libs this thing depends on...
#	$(LDC) $(LDC_FLAGS) $(STARTUP) pltek$O $(TO) $@ \
#		$(LDC_LIBS)

plrender$E:	$(PLLIBS) plrender$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) plrender$O $(PLLIB_LDC) $(TO) $@ \
		$(LDC_LIBS) $(RPATH)

pltcl$E:	$(TCLLIB_SO) pltcl$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) pltcl$O -L$(PLLIB_DIR) $(TCL_LINK) \
	$(TO) $@ $(LDC_LIBS)  $(RPATH)

plserver$E:	$(TCLLIB_SO) plserver$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) plserver$O -L$(PLLIB_DIR) $(TCL_LINK)\
	$(TO) $@ $(LDC_LIBS) $(RPATH)

# -----------------------------------------------------------------------------
# note this only builds something that can be used if PYTHONPATH is set 
# to tmp.  Therefore only really useful for temporary tests in tmp until 
# it is decided to do the install.
# N.B. the --flat option for setup.py takes care of different logic required
# for the case of the flat tmp directory.
plplotcmodule$(SO) plplot_widgetmodule$(SO): $(PLLIBS) plplotcmodule.c plplot_widgetmodule.c
	@echo " "
	@echo "Building Python modules."
	@echo " "
	# Start fresh (--force) each time since previous build may
	# be for an installation rather than for present plplot/tmp location.
	python setup.py build --force --build-temp="./" --build-lib="./" --flat

# -----------------------------------------------------------------------------
# Font files.
# Note it is no longer necessary to actually make these since as of
# PLPLOT 4.99a the font files are portable.
#
# sfont - standard font
# xfont - extended fonts

fonts:	sfont xfont

sfont:	$(PLFNT_PATH)plstnd5.fnt
xfont:	$(PLFNT_PATH)plxtnd5.fnt

$(PLFNT_PATH)plstnd5.fnt: stndfont$E pdfutils$O $(FONT_OBJ)
	-./stndfont$E
	-mv *.fnt $(PLFNT_DIR)

$(PLFNT_PATH)plxtnd5.fnt: xtndfont$E pdfutils$O $(FONT_OBJ)
	-./xtndfont$E
	-mv *.fnt $(PLFNT_DIR)

stndfont$E:	$(PLLIBS) stndfont$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) stndfont$O $(FONT_OBJ) \
		$(PLLIB_LDC) $(TO) $@ $(LDC_LIBS)

xtndfont$E:	$(PLLIBS) xtndfont$O
	$(LDC) $(LDC_FLAGS) $(STARTUP) xtndfont$O $(FONT_OBJ) \
		$(PLLIB_LDC) $(TO) $@ $(LDC_LIBS)

