#
#   Makefile.fpc for FP IDE
#

[targets]
programs=fp
rst=fpstrings

[install]
datadir=$(BASEINSTALLDIR)/ide

[dirs]
fpcdir=../..

[require]
options=-Sg
packages=api fv gdbint

[libs]
libgcc=1


[postsettings]
# when making a full version include the compiler
ifeq ($(FULL),1)
override UNITDIR+=../../compiler
else
override UNITDIR+=../fake/compiler
endif

# when including debugger include the gdbinterface
ifndef GDBINT
GDBINT=gdbint
endif

ifeq ($(GDB),1)
GDBLIBDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
GDBOBJDIR+=$(PACKAGESDIR)/$(GDBINT)/libgdb/$(OS_TARGET)
ifeq ($(OS_TARGET),go32v2)
ifneq ($(DJDIR),)
GDBLIBDIR+=$(DJDIR)/lib
endif
endif
ifeq ($(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))),)
override GDB=0
endif
endif

ifeq ($(GDB),1)
# The gdbint is already included due the gdbint package dependency
override LIBDIR+=$(GDBLIBDIR)
override OBJDIR+=$(GDBOBJDIR)
else
override UNITDIR+=../fake/gdb
endif

ifeq ($(FULL),1)
override OPT+=-dBrowserCol -dGDB
endif


[rules]
.PHONY: gdb full fullgdb clean_compiler clean

clean: fpc_cleanall

distclean: clean

fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)

gdb:
        $(MAKE) all GDB=1

full:
        $(MAKE) all FULL=1

fullgdb:
        $(MAKE) all FULL=1 GDB=1

# This is necessary because we don't have all units separate in the
# units targets
clean: fpc_cleanall

#
# Installation
#

install: fpc_install
        $(MKDIR) $(DATAINSTALLDIR)
        $(INSTALL) $(wildcard *.pt) $(wildcard *.tdf) readme.txt $(DATAINSTALLDIR)

#
# Misc
#
clean_compiler:
        $(MAKE) -C ../../compiler clean
