Makefile.fpc 4.7 KB

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