#######################################################################
# Makefile for examples. Started by Frank Loemker, 
# Adapted by Michael Van Canneyt 
#######################################################################
# Start of configurable section.
#######################################################################

# What compiler to use ?
PP=ppc386

# Where are the GTK and X libs ? 
XLIBPATH = /usr/X11R6/lib
GTKLIBPATH=/usr/X11R6/lib

# Where are the pascal gtk and gdk units ?
UNITDIR = ../gtk\;../gdk

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

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

# If nothing special needs doing, then just fill in the names here.
# The rest should be automatic.
UNITNAMES	=tictactoe
PROGNAMES	=entry notebook scribble-simple clist ttt_test pixmap list
UNITOBJECTS	=$(addsuffix .o, $(UNITNAMES))
UNITFILES	=$(addsuffix .ppu, $(UNITNAMES))
PROGSOURCES	=$(addsuffix .pas, $(PROGNAMES))
PROGOBJECTS	=$(addsuffix .o, $(PROGNAMES))

# Add unitdir to options.
OPT	+= -Up$(UNITDIR)

# If X lib path set, add it.
ifneq ($(XLIBPATH),)
OPT	+= -Fl$(XLIBPATH)
endif

# If GTK lib path set, and it is different from X path, add it.
ifneq ($(GTKLIBPATH),)
ifneq ($(GTKLIBPATH),$(XLIBPATH))
OPT	+= -Fl$(GTKLIBPATH)
endif
endif

# Default rule for units
.pas.ppu:
	$(PP) $(OPT) $<

# Default target.
all: $(UNITFILES) $(PROGNAMES)

units: $(UNITFILES)

progs: $(PROGNAMES)

# Default rule for programs
$(PROGNAMES): %:%.pas
	$(PP) $(OPT) $<

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

depend:
	sh makedep $(UNITNAMES) $(PROGNAMES)

# include dependencies
include depend
