makefile 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. #
  2. # $Id$
  3. # This file is part of the Free Pascal run time library.
  4. # Copyright (c) 1996-98 by Michael van Canneyt
  5. #
  6. # Makefile for the Free Pascal Linux Runtime Library
  7. #
  8. # See the file COPYING.FPC, included in this distribution,
  9. # for details about the copyright.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. #
  15. #####################################################################
  16. # Start of configurable section.
  17. # Please note that all these must be set in the main makefile, and
  18. # should be set there.
  19. # Don't remove the indef statements. They serve to avoid conflicts
  20. # with the main makefile.
  21. #####################################################################
  22. # What is the Operating System ?
  23. ifndef OS_SOURCE
  24. OS_SOURCE=linux
  25. endif
  26. # What is the target operating system ?
  27. ifndef OS_TARGET
  28. OS_TARGET=linux
  29. endif
  30. # What is the target processor :
  31. ifndef CPU
  32. CPU=i386
  33. #CPU=m68k
  34. endif
  35. # What compiler to use ?
  36. ifndef PP
  37. PP=ppc386
  38. endif
  39. # What options to pass to the compiler ?
  40. # You may want to specify a config file or error definitions file here.
  41. ifndef OPT
  42. OPT=
  43. endif
  44. # Where is the PPUMOVE program ?
  45. ifndef PPUMOVE
  46. PPUMOVE=ppumove
  47. endif
  48. # Set this to 'shared' or 'static'
  49. LIBTYPE=shared
  50. # AOUT should be defined in main makefile.
  51. # But you can set it here too.
  52. # AOUT = -DAOUT
  53. # Do you want to link to the C library ?
  54. # Standard it is NO. You can set it to YES to link in th C library.
  55. ifndef LINK_TO_C
  56. LINK_TO_C=NO
  57. endif
  58. #####################################################################
  59. # End of configurable section.
  60. # Do not edit after this line.
  61. #####################################################################
  62. #####################################################################
  63. # System independent
  64. #####################################################################
  65. # Where are the include files ?
  66. INC=../inc
  67. PROCINC=../$(CPU)
  68. CFG=../cfg
  69. OBJPASDIR=../objpas
  70. # Get some defaults for Programs and OSes.
  71. # This will set the following variables :
  72. # inlinux indos COPY REPLACE DEL INSTALL INSTALLEXE MKDIR
  73. # It will also set OPT for cross-compilation, and add required options.
  74. # also checks for config file.
  75. # it expects INC PROCINC to be set !!
  76. include $(CFG)/makefile.cfg
  77. # Get the system independent include file names.
  78. # This will set the following variables :
  79. # SYSINCNAMES
  80. include $(INC)/makefile.inc
  81. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  82. # Get the processor dependent include file names.
  83. # This will set the following variables :
  84. # CPUINCNAMES
  85. include $(PROCINC)/makefile.cpu
  86. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  87. # Put system unit dependencies together.
  88. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  89. #####################################################################
  90. # System dependent
  91. #####################################################################
  92. # Check if we need C library.
  93. ifeq ($(LINK_TO_C),YES)
  94. override OPT:=$(OPT) -dCRTLIB
  95. endif
  96. # Define Linux Units
  97. SYSTEMPPU=syslinux$(PPUEXT)
  98. OBJECTS=strings linux objpas \
  99. dos crt objects printer \
  100. getopts errors sockets graph\
  101. # Extra Syslinux Depends
  102. ifeq ($(LINK_TO_C),YES)
  103. SYSLINUXDEPS=lprt$(OEXT)
  104. else
  105. SYSLINUXDEPS=sysconst.inc systypes.inc syscalls.inc
  106. endif
  107. # Determine on what dos unit should depend.
  108. DOSDEPS = dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT)
  109. ifeq ($(LINK_TO_C),YES)
  110. DOSDEPS:=$(DOSDEPS) lprt$(OEXT)
  111. else
  112. DOSDEPS:=$(DOSDEPS) linux$(PPUEXT)
  113. endif
  114. # Which prt to use ?
  115. ifdef AOUT
  116. PRT=prt0
  117. else
  118. PRT=prt1
  119. endif
  120. LOADERAS=$(CPU)/$(PRT).as
  121. GLOADERAS=$(CPU)/g$(PRT).as
  122. # Define Loaders
  123. ifeq ($(LINK_TO_C),NO)
  124. LOADERS=prt0 gprt0
  125. else
  126. LOADERS=lprt
  127. endif
  128. # Add Prefix and Suffixes
  129. OBJLOADERS=$(addsuffix $(OEXT), $(LOADERS))
  130. PPUOBJECTS=$(addsuffix $(PPUEXT), $(OBJECTS))
  131. .PHONY : all install clean \
  132. libs libsclean \
  133. diffs diffclean \
  134. all : $(OBJLOADERS) $(PPUOBJECTS)
  135. install : all
  136. $(MKDIR) $(UNITINSTALLDIR)
  137. $(INSTALL) *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)
  138. clean :
  139. -$(DEL) *$(OEXT) *$(ASMEXT) *$(PPUEXT) *.PPS log
  140. #####################################################################
  141. # Files
  142. #####################################################################
  143. #
  144. # Loaders
  145. #
  146. prt0$(OEXT) : $(LOADERAS)
  147. -as $(LOADERAS) -o prt0$(OEXT)
  148. gprt0$(OEXT) : $(GLOADERAS)
  149. -as $(GLOADERAS) -o gprt0$(OEXT)
  150. lprt$(OEXT) : lprt.c
  151. gcc $(AOUT) -c lprt.c -o lprt$(OEXT)
  152. #
  153. # Base Units (System, strings, os-dependent-base-unit)
  154. #
  155. $(SYSTEMPPU) : syslinux.pp $(SYSLINUXDEPS) $(SYSDEPS)
  156. $(PP) $(OPT) -Us -Sg syslinux.pp $(REDIR)
  157. strings$(PPUEXT) : $(PROCINC)/strings.pp $(SYSTEMPPU)
  158. $(COPY) $(PROCINC)/strings.pp .
  159. $(PP) $(OPT) strings $(REDIR)
  160. $(DEL) strings.pp
  161. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  162. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  163. $(PP) $(OPT) linux.pp $(REDIR)
  164. #
  165. # Delphi Object Model
  166. #
  167. objpas$(PPUEXT) : $(OBJPASDIR)/objpas.pp $(SYSTEMPPU)
  168. $(COPY) $(OBJPASDIR)/objpas.pp .
  169. $(PP) $(OPT) objpas $(REDIR)
  170. $(DEL) objpas.pp
  171. #
  172. # System Dependent Units
  173. #
  174. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  175. linux$(PPUEXT) $(SYSTEMPPU)
  176. $(PP) $(OPT) sockets.pp $(REDIR)
  177. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  178. $(PP) $(OPT) errors.pp $(REDIR)
  179. #
  180. # TP7 Compatible RTL Units
  181. #
  182. dos$(PPUEXT) : $(DOSDEPS) $(SYSTEMPPU)
  183. $(PP) $(OPT) dos $(REDIR)
  184. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc $(INC)/filerec.inc linux$(PPUEXT)\
  185. $(SYSTEMPPU)
  186. $(PP) $(OPT) crt $(REDIR)
  187. objects$(PPUEXT) : objects.pp $(SYSTEMPPU)
  188. $(PP) $(OPT) objects $(REDIR)
  189. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  190. $(PP) $(OPT) printer $(REDIR)
  191. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  192. $(PP) $(OPT) graph $(REDIR)
  193. #
  194. # Other RTL Units
  195. #
  196. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  197. $(COPY) $(INC)/getopts.pp .
  198. $(PP) $(OPT) getopts $(REDIR)
  199. $(DEL) getopts.pp
  200. #####################################################################
  201. # Libs
  202. #####################################################################
  203. libs : all libfpc$(LIBEXT)
  204. libfpc.so:
  205. $(PPUMOVE) -o fpc *.ppu
  206. libfpc.a:
  207. $(PPUMOVE) -s -o fpc *.ppu
  208. libinstall : libs
  209. $(INSTALLEXE) libfpc$(LIBEXT) $(LIBINSTALLDIR)
  210. $(INSTALL) *$(PPLEXT) $(UNITINSTALLDIR)
  211. ldconfig
  212. libsclean : clean
  213. -$(DEL) *.a *.so *$(PPLEXT)
  214. #####################################################################
  215. # Default targets
  216. #####################################################################
  217. include $(CFG)/makefile.def