Makefile.fpc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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. ifeq ($(GDB),1)
  100. ifneq ($(GDBFOUND),0)
  101. override COMPILER+=-dWITH_GDB
  102. endif
  103. endif
  104. fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
  105. testgdb:
  106. ifneq ($(GDBFOUND),0)
  107. @$(ECHO) LibGDB found in $(LIBGDB)
  108. else
  109. @$(ECHO) LibGDB not found
  110. @$(ECHO) LIBGDB=$(LIBGDB)
  111. @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
  112. @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))
  113. endif
  114. postgdbinfo:
  115. ifeq ($(GDBFOUND),0)
  116. @$(ECHO) LibGDB was not found, IDE has no Debugger support
  117. endif
  118. #
  119. # Compiler
  120. #
  121. compilerunits : compiler/$(FPCMADE)
  122. compiler/$(FPCMADE):
  123. $(MAKE) -C compiler all
  124. compilerclean :
  125. $(MAKE) -C compiler clean
  126. #
  127. # Fake GDB
  128. #
  129. fakegdbunits : fakegdb/$(FPCMADE)
  130. fakegdb/$(FPCMADE):
  131. $(MAKE) -C fakegdb all
  132. fakegdbclean :
  133. $(MAKE) -C fakegdb clean
  134. fakegdbinfo:
  135. @$(ECHO) Using FakeGDB, IDE has no Debugger support
  136. #
  137. # Build targets
  138. #
  139. # building happends in 2 steps, first the packages, compiler and fakegdb
  140. # dirs are build. In the second step the IDE is build. This is
  141. # required because it needs to detect which compiler version
  142. # to use.
  143. #
  144. builddirs: compilerunits fakegdbunits
  145. buildfp: fpc_all
  146. gdb:
  147. $(MAKE) builddirs
  148. $(MAKE) testgdb buildfp postgdbinfo GDB=1
  149. nogdb:
  150. $(MAKE) builddirs
  151. $(MAKE) buildfp fakegdbinfo
  152. #
  153. # Default targets
  154. #
  155. # By default we try to create the ide with full debugging support,
  156. # if gdbint and libgdb is not available it will fallback to use
  157. # fakegdb
  158. all: gdb
  159. # This is necessary because we don't have all units separate in the
  160. # units targets
  161. clean: cleanall
  162. #
  163. # Installation
  164. #
  165. ifndef UNIXINSTALLDIR
  166. override INSTALL_DATADIR=$(INSTALL_BINDIR)
  167. endif
  168. install: fpc_install
  169. $(MKDIR) $(INSTALL_DATADIR)
  170. $(MKDIR) $(INSTALL_DOCDIR)
  171. $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
  172. ifeq ($(OS_TARGET),win32)
  173. $(INSTALL) fp32.ico $(INSTALL_DATADIR)
  174. endif
  175. $(INSTALL) readme.ide $(INSTALL_DOCDIR)
  176. #
  177. # Misc
  178. #
  179. clean_compiler:
  180. $(MAKE) -C compiler clean
  181. $(MAKE) -C ../compiler ppuclean