#****************************************************************************
#
#                   Copyright (c) 1993,95 by Florian Klmpfl
#          Modified and enhanced for GNU make under Linux by M. Van Canneyt
#****************************************************************************
#
# The parameters are set in the main makefile.
# here we specify the defaults.

#
# GCCLIBPATH is wat is it on my PC... it MUST be set in the main Makefile
#
ifndef GCCLIBPATH
GCCLIBPATH=/usr/lib/gcc-lib/i486-linux/2.6.3
endif

ifndef PROGINSTALLDIR
PROGINSTALLDIR = /usr/local/bin
endif

ifndef LIBINSTALLDIR
LIBINSTALLDIR = /usr/lib/ppc/0.9.1
# for aout system
# LIBINSTALLDIR = /usr/lib/ppc/aout/0.9.1
endif

# specify where units are.
ifndef UNITDIR
UNITDIR=../rtl/linux
# for aout
#UNITDIR=/usr/lib/ppc/aout/0.9.1/linuxunits
endif

ifndef PP 
PP=ppc386  
endif

ifndef PPOPTS
PPOPTS= -Ch8000000 -dI386 -dGDB -dCLEANUP -a -Sg -g -Up$(UNITDIR)
# for aout.
# PPOPTS= -e/usr/i486-linuxaout/bin -a -Sg -OGa  -g -q+ -w- -Up$(UNITDIR)
endif

compiler = $(PP) $(PPOPTS)


# Do we need the GCC library ?
ifeq ($(LINK_TO_C),YES)
compiler:=$(compiler) -Fg$(GCCLIBPATH)
endif

.SUFFIXES: .pas .ppu

.pas.ppu:
	$(compiler) $<

all : ppc386

# All dependencies come from Florian's makefile for DOS - renamed and edited.
include depend

install : all
	install -m 755 -d $(LIBINSTALLDIR)
	install -m 755 ppc386 $(LIBINSTALLDIR)
	ln -sf $(LIBINSTALLDIR)/ppc386 $(PROGINSTALLDIR)/ppc386
	makeppccfg $(LIBINSTALLDIR) $(GCCLIBPATH)
	install -m 644 ppc386.cfg /etc
	install -m 644 errorE.msg $(LIBINSTALLDIR)
	@echo Wrote sample configuration file to /etc

clean :
	-rm -f *.o *.ppu *.s ppc386 ppc386.cfg