Makefile.fpc.fpcmake 4.9 KB

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