Makefile.fpc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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.7.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. ifeq ($(OS_TARGET),freebsd)
  44. needusrlocallib=1
  45. endif
  46. ifeq ($(OS_TARGET),openbsd)
  47. needusrlocallib=1
  48. endif
  49. ifdef needlinkparam
  50. override SPECIALLINK=-Xe -k--allow-multiple-definition
  51. endif
  52. ifdef needusrlocallib
  53. override SPECIALLINK+=-Fl/usr/local/lib
  54. endif
  55. # Try to find GDB library
  56. # Look for a valid GDBLIBDIR environment variable
  57. ifdef GDBLIBDIR
  58. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  59. endif
  60. # Use default dirs if not available
  61. ifeq ($(LIBGDBFILE),)
  62. # Default locations <target>/<cpu> (linux) or <target> (win32,go32v2) only
  63. override GDBLIBDIR=$(wildcard $(FPCDIR)/libgdb/$(OS_TARGET)/$(CPU_TARGET))
  64. ifeq ($(GDBLIBDIR),)
  65. override GDBLIBDIR=$(FPCDIR)/libgdb/$(OS_TARGET)
  66. endif
  67. # Detect if libgdb.a is available
  68. override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
  69. endif
  70. # No custom libgdb.a found, try using system default library if available
  71. ifeq ($(LIBGDBFILE),)
  72. SYSLIBDIR=/lib /usr/lib /usr/local/lib
  73. # Detect if libgdb.a is available
  74. override LIBGDBFILE=$(firstword $(wildcard $(addsuffix /libgdb.a,$(SYSLIBDIR))))
  75. ifneq (${LIBGDBFILE},)
  76. $(warning Using system default libgdb file located in ${LIBGDBFILE})
  77. GDBLIBDIR=$(dir ${LIBGDBFILE})
  78. endif
  79. endif
  80. # Disable GDB when no libgdb.a found
  81. ifeq ($(LIBGDBFILE),)
  82. GDB=
  83. else
  84. GDB=1
  85. # Detect if gdblib.inc is available
  86. override LIBGDBINC:=$(firstword $(wildcard $(addsuffix /gdblib.inc,$(GDBLIBDIR))))
  87. ifeq ($(LIBGDBINC),)
  88. GDBLIBINCFOUND=0
  89. GDBLIBINCCOND=
  90. else
  91. GDBLIBINCFOUND=1
  92. GDBLIBINCCOND=-dUSE_GDBLIBINC -I$(GDBLIBDIR)
  93. endif
  94. endif
  95. ifdef GDB
  96. # The gdbint is already included due the gdbint package dependency
  97. override LIBDIR+=$(GDBLIBDIR)
  98. endif
  99. else
  100. # Disable
  101. GDB=
  102. endif #NOGDB
  103. [rules]
  104. .NOTPARALLEL:
  105. .PHONY: compilerunits compilerclean \
  106. nogdb gdb all \
  107. clean_compiler clean testgdb postgdbinfo
  108. clean: fpc_cleanall
  109. distclean: clean compilerclean
  110. #
  111. # GDB detection
  112. #
  113. ifndef NOGDB
  114. ifdef GDB
  115. testgdb:
  116. @$(ECHO) LibGDB found in $(LIBGDBFILE)
  117. postgdbinfo:
  118. @$(ECHO) LibGDB was found, IDE has Debugger support
  119. else
  120. override COMPILER+=-dNODEBUG
  121. testgdb:
  122. @$(ECHO) LibGDB not found
  123. @$(ECHO) LIBGDBFILE=$(LIBGDBFILE)
  124. @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
  125. @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))
  126. postgdbinfo:
  127. @$(ECHO) LibGDB was not found, IDE has no Debugger support
  128. endif
  129. else
  130. testgdb:
  131. @$(ECHO) Building without Debugger
  132. postgdbinfo:
  133. @$(ECHO) Debugger disabled, IDE has no Debugger support
  134. override COMPILER+=-dNODEBUG
  135. endif # NOGDB
  136. #
  137. # Compiler
  138. #
  139. compilerunits : compiler/$(FPCMADE)
  140. compiler/$(FPCMADE):
  141. $(MAKE) -C compiler all
  142. compilerclean :
  143. $(MAKE) -C compiler clean
  144. #
  145. # Build targets
  146. #
  147. # building happends in 2 steps, first the packages, compiler
  148. # dirs are build. In the second step the IDE is build. This is
  149. # required because it needs to detect which compiler version
  150. # to use.
  151. #
  152. fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
  153. $(COMPILER) $(GDBLIBINCCOND) $(SPECIALLINK) fp.pas
  154. buildfp:
  155. $(MAKE) compilerunits
  156. $(MAKE) testgdb
  157. $(MAKE) fpc_all
  158. $(MAKE) postgdbinfo
  159. gdb:
  160. # $(MAKE) -C ../packages/base/gdbint
  161. $(MAKE) buildfp
  162. nogdb:
  163. $(MAKE) buildfp NOGDB=1
  164. #
  165. # Default targets
  166. #
  167. # By default we try to create the ide with full debugging support,
  168. all: gdb
  169. # This is necessary because we don't have all units separate in the
  170. # units targets
  171. clean: cleanall
  172. #
  173. # Installation
  174. #
  175. ifndef UNIXHier
  176. override INSTALL_DATADIR=$(INSTALL_BINDIR)
  177. endif
  178. install: fpc_install
  179. $(MKDIR) $(INSTALL_DATADIR)
  180. $(MKDIR) $(INSTALL_DOCDIR)
  181. $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
  182. ifeq ($(OS_TARGET),win32)
  183. $(INSTALL) fp32.ico $(INSTALL_DATADIR)
  184. endif
  185. $(INSTALL) readme.ide $(INSTALL_DOCDIR)
  186. #
  187. # Misc
  188. #
  189. clean_compiler:
  190. $(MAKE) -C compiler clean
  191. $(MAKE) -C ../compiler ppuclean