Makefile.fpc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. #
  2. # $Id: Makefile.fpc,v 1.32 2005/05/05 12:59:59 peter Exp $
  3. #
  4. # Makefile.fpc for FP IDE
  5. #
  6. [package]
  7. name=ide
  8. version=2.5.1
  9. [target]
  10. dirs=compiler
  11. programs=fp
  12. rst=fpstrings
  13. [install]
  14. datadir=$(INSTALL_BASEDIR)/ide
  15. fpcpackage=y
  16. [compiler]
  17. options=-Sg
  18. [require]
  19. packages=fv gdbint regexpr chm
  20. packages_go32v2=graph
  21. libc=y
  22. [default]
  23. fpcdir=..
  24. [prerules]
  25. #
  26. # Automatic detection if libgdb.a is present
  27. #
  28. # set default value for PPC_TARGET
  29. ifndef PPC_TARGET
  30. PPC_TARGET=$(CPU_TARGET)
  31. endif
  32. # do not add -d$(CPU_TARGET)
  33. override NOCPUDEF=1
  34. # Use PPC_TARGET instead
  35. override FPCOPT+= -d$(PPC_TARGET)
  36. ifndef NOGDB
  37. ifeq ($(FULL_TARGET),i386-win32)
  38. needlinkparam=1
  39. endif
  40. ifeq ($(FULL_TARGET),x86_64-win64)
  41. needlinkparam=1
  42. endif
  43. ifdef needlinkparam
  44. override SPECIALLINK=-Xe -k--allow-multiple-definition
  45. endif
  46. # Try to find GDB library
  47. # Look for a valid GDBLIBDIR environment variable
  48. ifdef GDBLIBDIR
  49. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  50. endif
  51. # Use default dirs if not available
  52. ifeq ($(LIBGDBFILE),)
  53. # Default locations <target>/<cpu> (linux) or <target> (win32,go32v2) only
  54. override GDBLIBDIR=$(wildcard $(FPCDIR)/libgdb/$(OS_TARGET)/$(CPU_TARGET))
  55. ifeq ($(GDBLIBDIR),)
  56. override GDBLIBDIR=$(FPCDIR)/libgdb/$(OS_TARGET)
  57. endif
  58. # Detect if libgdb.a is available
  59. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  60. endif
  61. # No custom libgdb.a found, try using system default library if available
  62. ifeq ($(LIBGDBFILE),)
  63. SYSLIBDIR=/lib /usr/lib /usr/local/lib
  64. # Detect if libgdb.a is available
  65. override LIBGDBFILE=$(firstword $(wildcard $(addsuffix /libgdb.a,$(SYSLIBDIR))))
  66. ifneq (${LIBGDBFILE},)
  67. $(warning Using system default libgdb file located in ${LIBGDBFILE})
  68. GDBLIBDIR=$(dir ${LIBGDBFILE})
  69. endif
  70. endif
  71. # Disable GDB when no libgdb.a found
  72. ifeq ($(LIBGDBFILE),)
  73. GDB=
  74. else
  75. GDB=1
  76. # Detect if gdblib.inc is available
  77. override LIBGDBINC:=$(firstword $(wildcard $(addsuffix /gdblib.inc,$(GDBLIBDIR))))
  78. ifeq ($(LIBGDBINC),)
  79. GDBLIBINCFOUND=0
  80. GDBLIBINCCOND=
  81. else
  82. GDBLIBINCFOUND=1
  83. GDBLIBINCCOND=-dUSE_GDBLIBINC -I$(GDBLIBDIR)
  84. endif
  85. endif
  86. ifdef GDB
  87. # The gdbint is already included due the gdbint package dependency
  88. override LIBDIR+=$(GDBLIBDIR)
  89. endif
  90. else
  91. # Disable
  92. GDB=
  93. endif #NOGDB
  94. [rules]
  95. .NOTPARALLEL:
  96. .PHONY: compilerunits compilerclean \
  97. nogdb gdb all \
  98. clean_compiler clean testgdb postgdbinfo
  99. clean: fpc_cleanall
  100. distclean: clean compilerclean
  101. #
  102. # GDB detection
  103. #
  104. ifndef NOGDB
  105. ifdef GDB
  106. testgdb:
  107. @$(ECHO) LibGDB found in $(LIBGDBFILE)
  108. postgdbinfo:
  109. @$(ECHO) LibGDB was found, IDE has Debugger support
  110. else
  111. override COMPILER+=-dNODEBUG
  112. testgdb:
  113. @$(ECHO) LibGDB not found
  114. @$(ECHO) LIBGDBFILE=$(LIBGDBFILE)
  115. @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
  116. @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))
  117. postgdbinfo:
  118. @$(ECHO) LibGDB was not found, IDE has no Debugger support
  119. endif
  120. else
  121. testgdb:
  122. @$(ECHO) Building without Debugger
  123. postgdbinfo:
  124. @$(ECHO) Debugger disabled, IDE has no Debugger support
  125. override COMPILER+=-dNODEBUG
  126. endif # NOGDB
  127. #
  128. # Compiler
  129. #
  130. compilerunits : compiler/$(FPCMADE)
  131. compiler/$(FPCMADE):
  132. $(MAKE) -C compiler all
  133. compilerclean :
  134. $(MAKE) -C compiler clean
  135. #
  136. # Build targets
  137. #
  138. # building happends in 2 steps, first the packages, compiler
  139. # dirs are build. In the second step the IDE is build. This is
  140. # required because it needs to detect which compiler version
  141. # to use.
  142. #
  143. fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
  144. $(COMPILER) $(GDBLIBINCCOND) $(SPECIALLINK) fp.pas
  145. buildfp:
  146. $(MAKE) compilerunits
  147. $(MAKE) testgdb
  148. $(MAKE) fpc_all
  149. $(MAKE) postgdbinfo
  150. gdb:
  151. # $(MAKE) -C ../packages/base/gdbint
  152. $(MAKE) buildfp
  153. nogdb:
  154. $(MAKE) buildfp NOGDB=1
  155. #
  156. # Default targets
  157. #
  158. # By default we try to create the ide with full debugging support,
  159. all: gdb
  160. # This is necessary because we don't have all units separate in the
  161. # units targets
  162. clean: cleanall
  163. #
  164. # Installation
  165. #
  166. ifndef UNIXHier
  167. override INSTALL_DATADIR=$(INSTALL_BINDIR)
  168. endif
  169. install: fpc_install
  170. $(MKDIR) $(INSTALL_DATADIR)
  171. $(MKDIR) $(INSTALL_DOCDIR)
  172. $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
  173. ifeq ($(OS_TARGET),win32)
  174. $(INSTALL) fp32.ico $(INSTALL_DATADIR)
  175. endif
  176. $(INSTALL) readme.ide $(INSTALL_DOCDIR)
  177. #
  178. # Misc
  179. #
  180. clean_compiler:
  181. $(MAKE) -C compiler clean
  182. $(MAKE) -C ../compiler ppuclean