#######################################################################
#   Makefile for SVGALIB for Free Pascal 
#   (C) 1998 Michael van Canneyt
#######################################################################
#
#  Configurable section
#

# What Compiler should we use ?
PP=ppc386

# Where are the Free Pascal units ? (Optional)
# UNITDIR = /usr/lib/fpc/0.99.5/linuxunits

# Any options you wish to pass to the compiler
OPT=

# if libsvga is NOT in /usr/lib where is it then ?
# SVGLIBDIR=

# Where to install the units ?
UNITINSTALLDIR=/usr/lib/fpc/0.99.5/linuxunits

# Where to install the programs ?
BININSTALLDIR=/usr/local/bin

#######################################################################
# End of configurable section. Do not edit below this line.
#######################################################################

.SUFFIXES: .pp .ppu .pas
.PHONY: all install clean

UNITNAMES=svgalib vgamouse
PROGNAMES=testvga vgatest

UNITOBJECTS=$(addsuffix .o, $(UNITNAMES))
UNITFILES=$(addsuffix .ppu, $(UNITNAMES))
PROGSOURCES=$(addsiffix .pp, $(PROGNAMES))
PROGOBJECTS=$(addsuffix .o, $(PROGNAMES))

ifdef UNITDIR
override OPT:=$(OPT) -Up$(UNITDIR)
endif

ifdef SVGALIBDIR
override OPT:=$(OPT) -k-L$(SVGALIBDIR)
endif

.pp.ppu:
	$(PP) $(OPT) $<

units: $(UNITFILES)

test: $(PROGNAMES)

all: $(UNITFILES) $(PROGNAMES)

$(PROGNAMES): %:%.pp
	$(PP) $(OPT) $<
#
# Generic install and clean targets
#

install: units
	install -m 755 $(UNITINSTALLDIR)
	install -m 666 $(UNITNAMES) $(UNITINSTALLDIR)

clean:
	rm -f $(UNITOBJECTS) $(UNITFILES) $(PROGNAMES) $(PROGOBJECTS)

# End of makefile.
