Makefile.fpc 4.2 KB

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