fpc/packages/base/gdbint/Makefile.fpc
2004-01-05 23:29:35 +00:00

132 lines
2.6 KiB
Makefile

#
# Makefile.fpc for Free Pascal GDB Interface
#
[package]
name=gdbint
version=1.9.2
[target]
units=gdbint gdbcon
examples=testgdb symify
[compiler]
objectdir=$(GDBLIBDIR)
librarydir=$(GDBLIBDIR)
[require]
libc=y
[install]
fpcpackage=y
[default]
fpcdir=../../..
[prerules]
# For unix be sure to use the locally created gdbver
ifdef inUnix
CURRDIR=./
else
CURRDIR=
endif
# Look for a valid GDBLIBDIR environment variable
ifdef GDBLIBDIR
override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
endif
# Use default dirs if not available
ifeq ($(LIBGDBFILE),)
override GDBLIBDIR=libgdb/$(OS_TARGET)
ifeq ($(OS_TARGET),go32v2)
ifneq ($(DJDIR),)
GDBLIBDIR+=$(DJDIR)/lib
endif
endif
# Detect if libgdb.a is available
override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
endif
# Set GDBFOUND variable
ifeq ($(LIBGDBFILE),)
GDBFOUND=0
else
GDBFOUND=1
endif
[rules]
ifeq ($(OS_SOURCE)$(CPU_SOURCE),$(OS_TARGET)$(CPU_TARGET))
ifeq ($(GDBFOUND),1)
# libgdb.a found
$(CURRDIR)getver$(EXEEXT) : gdbver.pp
$(COMPILER) -o$(CURRDIR)getver$(EXEEXT) gdbver.pp
ifndef GOTGDBVER
# gdbver doesn't exists, build it first
gdbint$(PPUEXT): $(CURRDIR)gdbver$(EXEEXT)
$(MAKE) gdbint$(PPUEXT) GOTGDBVER=1
else
# gdbver exists
GDBVER:=GDB_V$(strip $(shell $(CURRDIR)gdbver$(EXEEXT) -n))
gdbint$(PPUEXT): gdbint.pp
@$(ECHO) Using GDB $(GDBVER)
$(COMPILER) -d$(GDBVER) gdbint.pp
$(DEL) gdbver$(EXEEXT) gdbver$(OEXT)
endif
else
# libgdb.a not found, default to libgdb v5
GDBVER=GDB_V5
gdbint$(PPUEXT): gdbint.pp
@$(ECHO) libgdb.a not found, using default GDB $(GDBVER)
$(COMPILER) -d$(GDBVER) gdbint.pp
endif
else
# Different OS_TARGET, default to libgdb v5
GDBVER=GDB_V5
gdbint$(PPUEXT): gdbint.pp
@$(ECHO) Different target os or cpu, using default GDB $(GDBVER)
$(COMPILER) -d$(GDBVER) gdbint.pp
endif
gdbcon$(PPUEXT): gdbcon.pp gdbint$(PPUEXT)
ifeq ($(OS_TARGET),go32v2)
DBGCOM=dbgcom$(OEXT)
else
DBGCOM=
endif
ifdef $(COMPILEDBGCOM)
# FPC conditionnal remove the file watching mecanism introduced
# in v2.02 of dbgcom.c because it relies
# on the fact that all files are opened via C lib calls
# which is wrong for FPC !!
$(DBGCOM): ../v4.16/dbgcom.c
gcc -c -DFPC -Dother_sel -gstabs -o dbgcom.o -I../v4.16 ../v4.16/dbgcom.c
else
$(DBGCOM):
endif
simple: $(DBGCOM)
-rm gdbint.ppu
ppc386 -dUSE_LIBGDB gdbint
ppc386 testgdb
testgdb$(EXEEXT): testgdb.pp gdbint$(PPUEXT) gdbcon$(PPUEXT) $(DBGCOM)
# Allow test for example
.PHONY: test
test: examples
clean: fpc_clean
$(DEL) gdbver$(EXEEXT) gdbver$(OEXT)