#
#   Makefile.fpc for Free Pascal Compiler Utils
#

[target]
programs=fpc ppufiles ppudump ppumove fpcsubst mkarmins mkx86ins
rst=fpcsubst

[clean]
units=ppu crc usubst

[compiler]
unitdir=..
sourcedir=..

[install]
fpcpackage=y

[require]
tools=data2inc

[default]
fpcdir=../..

[shared]
build=n

[rules]
#
# PPU Tools
#

# not parallel because systems using an external linker will get conflicts
# due to overwriting each other's link.res file
.NOTPARALLEL:

ifndef NOCPUDEF
ppu$(PPUEXT): ../ppu.pas
	$(MAKE) ppu$(PPUEXT) NOCPUDEF=1

ppudump$(EXEEXT): ppudump.pp ppu$(PPUEXT)
	$(MAKE) ppudump$(EXEEXT) NOCPUDEF=1

ppufiles$(EXEEXT): ppufiles.pp ppu$(PPUEXT)
	$(MAKE) ppufiles$(EXEEXT) NOCPUDEF=1

ppumove$(EXEEXT): ppumove.pp ppu$(PPUEXT)
	$(MAKE) ppumove$(EXEEXT) NOCPUDEF=1

else
ppu$(PPUEXT): ../ppu.pas
        $(COMPILER) ../ppu.pas -Fu../generic -dGENERIC_CPU -Fi..

ppudump$(EXEEXT): ppudump.pp ppu$(PPUEXT)
        $(COMPILER) ppudump.pp -Fu../generic -dGENERIC_CPU -Fi..

ppufiles$(EXEEXT): ppufiles.pp ppu$(PPUEXT)
        $(COMPILER) ppufiles.pp -Fu../generic -dGENERIC_CPU -Fi..

ppumove$(EXEEXT): ppumove.pp ppu$(PPUEXT)
        $(COMPILER) ppumove.pp -Fu../generic -dGENERIC_CPU -Fi..

endif

msg2inc$(EXEEXT): $(COMPILER_UNITTARGETDIR) msg2inc.pp

fpcsubst$(EXEEXT): fpcsubst.pp usubst.pp

fpcmkcfg$(EXEEXT): fpcmkcfg.pp usubst.pp fpccfg.inc fpcfg.inc fpini.inc

ifneq ($(DATA2INC),)
fpccfg.inc: fpc.cft
        $(DATA2INC) -b -s fpc.cft fpccfg.inc DefaultConfig

fpcfg.inc : fpinc.cfg
        $(DATA2INC) -b -s fpinc.cfg fpcfg.inc fpcfg

fpini.inc : fpinc.ini
        $(DATA2INC) -b -s fpinc.ini fpini.inc fpini
endif

#
# Don't export some tools, which are found in the current dir if it's in
# the path, so are not valid for the subdirs
#

unexport PPUFILES PPUMOVE
