Makefile.fpc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #
  2. # Makefile.fpc for Free Pascal GDB Interface
  3. #
  4. [package]
  5. name=gdbint
  6. version=2.0.0
  7. [target]
  8. units=gdbint gdbcon
  9. examples=testgdb symify
  10. [compiler]
  11. objectdir=$(GDBLIBDIR)
  12. librarydir=$(GDBLIBDIR)
  13. [require]
  14. libc=y
  15. [install]
  16. fpcpackage=y
  17. [default]
  18. fpcdir=../../..
  19. [prerules]
  20. # For unix be sure to use the locally created gdbver
  21. ifdef inUnix
  22. CURRDIR=./
  23. else
  24. CURRDIR=
  25. endif
  26. # Look for a valid GDBLIBDIR environment variable
  27. ifdef GDBLIBDIR
  28. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  29. endif
  30. # Use default dirs if not available
  31. ifeq ($(LIBGDBFILE),)
  32. # Default locations <target>/<cpu> (linux) or <target> (win32,go32v2) only
  33. override GDBLIBDIR=$(wildcard $(FPCDIR)/libgdb/$(OS_TARGET)/$(CPU_TARGET))
  34. ifeq ($(GDBLIBDIR),)
  35. override GDBLIBDIR=$(FPCDIR)/libgdb/$(OS_TARGET)
  36. endif
  37. # Detect if libgdb.a is available
  38. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  39. endif
  40. # Set GDBFOUND variable
  41. ifeq ($(LIBGDBFILE),)
  42. GDBFOUND=0
  43. else
  44. GDBFOUND=1
  45. endif
  46. [rules]
  47. ifeq ($(FULL_SOURCE),$(FULL_TARGET))
  48. ifeq ($(GDBFOUND),1)
  49. # libgdb.a found
  50. $(CURRDIR)getver$(EXEEXT) : gdbver.pp
  51. $(COMPILER) -o$(CURRDIR)getver$(EXEEXT) gdbver.pp
  52. ifndef GOTGDBVER
  53. # gdbver doesn't exists, build it first
  54. gdbint$(PPUEXT): $(CURRDIR)gdbver$(EXEEXT) gdbint.pp
  55. $(MAKE) gdbint$(PPUEXT) GOTGDBVER=1
  56. else
  57. # gdbver exists
  58. GDBVER:=GDB_V$(strip $(shell $(CURRDIR)gdbver$(EXEEXT) -n))
  59. gdbint$(PPUEXT): gdbint.pp
  60. @$(ECHO) Using GDB $(GDBVER)
  61. $(COMPILER) -d$(GDBVER) gdbint.pp
  62. $(DEL) gdbver$(EXEEXT) gdbver$(OEXT)
  63. endif
  64. else
  65. # libgdb.a not found, default to libgdb v5
  66. GDBVER=GDB_V6
  67. gdbint$(PPUEXT): gdbint.pp
  68. @$(ECHO) libgdb.a not found, using default GDB $(GDBVER)
  69. $(COMPILER) -d$(GDBVER) gdbint.pp
  70. endif
  71. else
  72. # Different OS_TARGET, default to libgdb v5
  73. GDBVER=GDB_V5
  74. gdbint$(PPUEXT): gdbint.pp
  75. @$(ECHO) Different target os or cpu, using default GDB $(GDBVER)
  76. $(COMPILER) -d$(GDBVER) gdbint.pp
  77. endif
  78. gdbcon$(PPUEXT): gdbcon.pp gdbint$(PPUEXT)
  79. ifeq ($(OS_TARGET),go32v2)
  80. DBGCOM=dbgcom$(OEXT)
  81. else
  82. DBGCOM=
  83. endif
  84. ifdef $(COMPILEDBGCOM)
  85. # FPC conditionnal remove the file watching mecanism introduced
  86. # in v2.02 of dbgcom.c because it relies
  87. # on the fact that all files are opened via C lib calls
  88. # which is wrong for FPC !!
  89. $(DBGCOM): ../v4.16/dbgcom.c
  90. gcc -c -DFPC -Dother_sel -gstabs -o dbgcom.o -I../v4.16 ../v4.16/dbgcom.c
  91. else
  92. $(DBGCOM):
  93. endif
  94. simple: $(DBGCOM)
  95. -rm gdbint.ppu
  96. ppc386 -dUSE_LIBGDB gdbint
  97. ppc386 testgdb
  98. testgdb$(EXEEXT): testgdb.pp gdbint$(PPUEXT) gdbcon$(PPUEXT) $(DBGCOM)
  99. # Allow test for example
  100. .PHONY: test
  101. test: examples
  102. clean: fpc_clean
  103. $(DEL) gdbver$(EXEEXT) gdbver$(OEXT)