Makefile.fpc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #
  2. # Makefile.fpc for FP IDE
  3. #
  4. [package]
  5. name=ide
  6. version=1.0.6
  7. [target]
  8. dirs=compiler fakegdb
  9. programs=fp
  10. rst=fpstrings
  11. [install]
  12. datadir=$(INSTALL_BASEDIR)/ide
  13. fpcpackage=y
  14. [compiler]
  15. options=-Sg
  16. targetdir=.
  17. unitdir=compiler
  18. [require]
  19. packages=fv gdbint regexpr
  20. [default]
  21. fpcdir=..
  22. [prerules]
  23. #
  24. # Linux->Unix transistion fix
  25. #
  26. ifeq ($(OS_TARGET),linux)
  27. ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
  28. override FPCOPT+=-dUNIX
  29. endif
  30. endif
  31. ifeq ($(OS_TARGET),freebsd)
  32. ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
  33. override FPCOPT+=-dUNIX
  34. endif
  35. endif
  36. #
  37. # Automatic detection of the compiler version
  38. #
  39. # compilers 1.0.x need to define COMPILER_1_0.
  40. #
  41. # To detect 1.0.x compilers we look for finput.ppu. If this unit
  42. # is not found then we include 1.0.x compiler
  43. #
  44. ifeq ($(wildcard compiler/finput.*),)
  45. override FPCOPT+=-dCOMPILER_1_0
  46. endif
  47. #
  48. # Automatic detection if libgdb.a is present
  49. #
  50. # when including debugger include the gdbinterface
  51. ifndef GDBINT
  52. GDBINT=gdbint
  53. endif
  54. # Try to find GDB library
  55. ifeq ($(GDB),1)
  56. ifeq ($(DEBUG),1)
  57. # First test if a debug version exists in a specific dir
  58. ifneq ($(strip $(wildcard $(addsuffix /$(GDBINT)/libgdb/d$(OS_TARGET)/libgdb.a,$(PACKAGESDIR)))),)
  59. OSGDBDIR=d$(OS_TARGET)
  60. else
  61. OSGDBDIR=$(OS_TARGET)
  62. endif
  63. else
  64. OSGDBDIR=$(OS_TARGET)
  65. endif
  66. GDBLIBDIR+=$(wildcard $(addsuffix /$(GDBINT)/libgdb/$(OSGDBDIR),$(PACKAGESDIR)))
  67. GDBOBJDIR+=$(wildcard $(addsuffix /$(GDBINT)/libgdb/$(OSGDBDIR),$(PACKAGESDIR)))
  68. ifeq ($(OS_TARGET),go32v2)
  69. ifneq ($(DJDIR),)
  70. GDBLIBDIR+=$(DJDIR)/lib
  71. endif
  72. endif
  73. ifeq ($(strip $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))),)
  74. override GDB=0
  75. GDBFOUND=0
  76. else
  77. override LIBGDB=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  78. GDBFOUND=1
  79. endif
  80. endif
  81. ifeq ($(GDB),1)
  82. # The gdbint is already included due the gdbint package dependency
  83. override LIBDIR+=$(GDBLIBDIR)
  84. else
  85. override UNITDIR+=fakegdb
  86. endif
  87. [rules]
  88. .PHONY: compilerunits compilerclean \
  89. nogdb gdb all \
  90. clean_compiler clean testgdb postgdbinfo
  91. clean: fpc_cleanall
  92. distclean: clean compilerclean
  93. #
  94. # FVision or old FV detection
  95. #
  96. ifneq ($(wildcard $(UNITDIR_FV)/fvconsts$(PPUEXT)),)
  97. override COMPILER+=-dFVISION
  98. endif
  99. fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
  100. testgdb:
  101. ifneq ($(GDBFOUND),0)
  102. @$(ECHO) LibGDB found in $(LIBGDB)
  103. else
  104. @$(ECHO) LibGDB not found
  105. @$(ECHO) LIBGDB=$(LIBGDB)
  106. @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
  107. @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))
  108. endif
  109. postgdbinfo:
  110. ifeq ($(GDBFOUND),0)
  111. @$(ECHO) LibGDB was not found, IDE has no Debugger support
  112. endif
  113. #
  114. # Compiler
  115. #
  116. compilerunits : compiler/$(FPCMADE)
  117. compiler/$(FPCMADE):
  118. $(MAKE) -C compiler all
  119. compilerclean :
  120. $(MAKE) -C compiler clean
  121. #
  122. # Fake GDB
  123. #
  124. fakegdbunits : fakegdb/$(FPCMADE)
  125. fakegdb/$(FPCMADE):
  126. $(MAKE) -C fakegdb all
  127. fakegdbclean :
  128. $(MAKE) -C fakegdb clean
  129. fakegdbinfo:
  130. @$(ECHO) Using FakeGDB, IDE has no Debugger support
  131. #
  132. # Build targets
  133. #
  134. # building happends in 2 steps, first the packages, compiler and fakegdb
  135. # dirs are build. In the second step the IDE is build. This is
  136. # required because it needs to detect which compiler version
  137. # to use.
  138. #
  139. builddirs: compilerunits fakegdbunits
  140. buildfp: fpc_all
  141. gdb:
  142. $(MAKE) builddirs
  143. $(MAKE) testgdb buildfp postgdbinfo GDB=1
  144. nogdb:
  145. $(MAKE) builddirs
  146. $(MAKE) buildfp fakegdbinfo
  147. #
  148. # Default targets
  149. #
  150. # By default we try to create the ide with full debugging support,
  151. # if gdbint and libgdb is not available it will fallback to use
  152. # fakegdb
  153. all: gdb
  154. # This is necessary because we don't have all units separate in the
  155. # units targets
  156. clean: cleanall
  157. #
  158. # Installation
  159. #
  160. ifndef UNIXINSTALLDIR
  161. override INSTALL_DATADIR=$(INSTALL_BINDIR)
  162. endif
  163. install: fpc_install
  164. $(MKDIR) $(INSTALL_DATADIR)
  165. $(MKDIR) $(INSTALL_DOCDIR)
  166. $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
  167. $(INSTALL) readme.ide $(INSTALL_DOCDIR)
  168. #
  169. # Misc
  170. #
  171. clean_compiler:
  172. $(MAKE) -C compiler clean
  173. $(MAKE) -C ../compiler ppuclean