Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. #
  2. # Makefile generated by fpcmake v1.00 [2000/12/19]
  3. #
  4. defaultrule: all
  5. #####################################################################
  6. # Autodetect OS (Linux or Dos or Windows NT or OS/2)
  7. # define inUnix when running under Unix (Linux,FreeBSD)
  8. # define inWinNT when running under WinNT
  9. # define inOS2 when running under OS/2
  10. #####################################################################
  11. # We need only / in the path
  12. override PATH:=$(subst \,/,$(PATH))
  13. # Search for PWD and determine also if we are under linux
  14. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  15. ifeq ($(PWD),)
  16. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  17. ifeq ($(PWD),)
  18. nopwd:
  19. @echo You need the GNU utils package to use this Makefile!
  20. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  21. @exit
  22. else
  23. inUnix=1
  24. PWD:=$(firstword $(PWD))
  25. endif
  26. else
  27. PWD:=$(firstword $(PWD))
  28. endif
  29. # Detect NT - NT sets OS to Windows_NT
  30. # Detect OS/2 - OS/2 has OS2_SHELL defined
  31. ifndef inUnix
  32. ifeq ($(OS),Windows_NT)
  33. inWinNT=1
  34. else
  35. ifdef OS2_SHELL
  36. inOS2=1
  37. endif
  38. endif
  39. endif
  40. # The extension of executables
  41. ifdef inUnix
  42. SRCEXEEXT=
  43. else
  44. SRCEXEEXT=.exe
  45. endif
  46. # The path which is searched separated by spaces
  47. ifdef inUnix
  48. SEARCHPATH=$(subst :, ,$(PATH))
  49. else
  50. SEARCHPATH=$(subst ;, ,$(PATH))
  51. endif
  52. # Base dir
  53. ifdef PWD
  54. BASEDIR:=$(shell $(PWD))
  55. else
  56. BASEDIR=.
  57. endif
  58. #####################################################################
  59. # FPC version/target Detection
  60. #####################################################################
  61. # What compiler to use ?
  62. ifndef FPC
  63. # Compatibility with old makefiles
  64. ifdef PP
  65. FPC=$(PP)
  66. else
  67. FPC=ppc386
  68. endif
  69. endif
  70. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  71. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  72. # Target OS
  73. ifndef OS_TARGET
  74. OS_TARGET:=$(shell $(FPC) -iTO)
  75. endif
  76. # Source OS
  77. ifndef OS_SOURCE
  78. OS_SOURCE:=$(shell $(FPC) -iSO)
  79. endif
  80. # Target CPU
  81. ifndef CPU_TARGET
  82. CPU_TARGET:=$(shell $(FPC) -iTP)
  83. endif
  84. # Source CPU
  85. ifndef CPU_SOURCE
  86. CPU_SOURCE:=$(shell $(FPC) -iSP)
  87. endif
  88. # FPC version
  89. ifndef FPC_VERSION
  90. FPC_VERSION:=$(shell $(FPC) -iV)
  91. endif
  92. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  93. #####################################################################
  94. # FPCDIR Setting
  95. #####################################################################
  96. # Test FPCDIR to look if the RTL dir exists
  97. ifdef FPCDIR
  98. override FPCDIR:=$(subst \,/,$(FPCDIR))
  99. ifeq ($(wildcard $(FPCDIR)/rtl),)
  100. ifeq ($(wildcard $(FPCDIR)/units),)
  101. override FPCDIR=wrong
  102. endif
  103. endif
  104. else
  105. override FPCDIR=wrong
  106. endif
  107. # Detect FPCDIR
  108. ifeq ($(FPCDIR),wrong)
  109. ifdef inUnix
  110. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  111. ifeq ($(wildcard $(FPCDIR)/units),)
  112. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  113. endif
  114. else
  115. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  116. override FPCDIR:=$(FPCDIR)/..
  117. ifeq ($(wildcard $(FPCDIR)/rtl),)
  118. ifeq ($(wildcard $(FPCDIR)/units),)
  119. override FPCDIR:=$(FPCDIR)/..
  120. ifeq ($(wildcard $(FPCDIR)/rtl),)
  121. ifeq ($(wildcard $(FPCDIR)/units),)
  122. override FPCDIR=c:/pp
  123. endif
  124. endif
  125. endif
  126. endif
  127. endif
  128. endif
  129. #####################################################################
  130. # User Settings
  131. #####################################################################
  132. # Targets
  133. # Clean
  134. # Install
  135. ZIPTARGET=install
  136. # Defaults
  137. # Directories
  138. # Packages
  139. # Libraries
  140. #####################################################################
  141. # Default Directories
  142. #####################################################################
  143. # Linux and freebsd use unix dirs with /usr/bin, /usr/lib
  144. # When zipping use the target as default, when normal install then
  145. # use the source os as default
  146. ifdef ZIPNAME
  147. # Zipinstall
  148. ifeq ($(OS_TARGET),linux)
  149. UNIXINSTALLDIR=1
  150. endif
  151. ifeq ($(OS_TARGET),freebsd)
  152. UNIXINSTALLDIR=1
  153. endif
  154. else
  155. # Normal install
  156. ifeq ($(OS_SOURCE),linux)
  157. UNIXINSTALLDIR=1
  158. endif
  159. ifeq ($(OS_SOURCE),freebsd)
  160. UNIXINSTALLDIR=1
  161. endif
  162. endif
  163. # set the prefix directory where to install everything
  164. ifndef PREFIXINSTALLDIR
  165. ifdef UNIXINSTALLDIR
  166. PREFIXINSTALLDIR=/usr
  167. else
  168. PREFIXINSTALLDIR=/pp
  169. endif
  170. endif
  171. export PREFIXINSTALLDIR
  172. # Where to place the resulting zip files
  173. ifndef DESTZIPDIR
  174. DESTZIPDIR:=$(BASEDIR)
  175. endif
  176. export DESTZIPDIR
  177. #####################################################################
  178. # Redirection
  179. #####################################################################
  180. ifndef REDIRFILE
  181. REDIRFILE=log
  182. endif
  183. ifdef REDIR
  184. ifndef inUnix
  185. override FPC=redir -eo $(FPC)
  186. endif
  187. # set the verbosity to max
  188. override FPCOPT+=-va
  189. override REDIR:= >> $(REDIRFILE)
  190. endif
  191. #####################################################################
  192. # Standard rules
  193. #####################################################################
  194. #####################################################################
  195. # Local Makefile
  196. #####################################################################
  197. ifneq ($(wildcard fpcmake.loc),)
  198. include fpcmake.loc
  199. endif
  200. #####################################################################
  201. # Users rules
  202. #####################################################################
  203. all:
  204. $(MAKE) -C $(OS_TARGET) all