Makefile.fpc.fpcmake 4.8 KB

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