makefile 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. # Do you want smartlinking enabled (YES/NO) ?
  36. ifndef SMARTLINK
  37. SMARTLINK=YES
  38. endif
  39. # Name of library ?
  40. # If this is set, all units will be put in the same library.
  41. # If it is empty (default), the units will be left in separate files.
  42. LIBNAME=
  43. #LIBNAME=fpc
  44. # Should the library be shared or static (only if LIBNAME is set).
  45. # Set this to 'shared' or 'static'.
  46. # Setting this to shared will disable smart linking.
  47. LIBTYPE=shared
  48. # What compiler to use ?
  49. ifndef PP
  50. PP=ppc386
  51. endif
  52. # What options to pass to the compiler ?
  53. # You may want to specify a config file or error definitions file here.
  54. ifndef OPT
  55. OPT=
  56. endif
  57. # Where is the PPUMOVE program ?
  58. ifndef PPUMOVE
  59. PPUMOVE=ppumove
  60. endif
  61. # AOUT should be defined in main makefile.
  62. # But you can set it here too.
  63. # AOUT = -DAOUT
  64. # Do you want to link to the C library ?
  65. # Standard it is NO. You can set it to YES to link in th C library.
  66. ifndef LINK_TO_C
  67. LINK_TO_C=NO
  68. endif
  69. #####################################################################
  70. # End of configurable section.
  71. # Do not edit after this line.
  72. #####################################################################
  73. #####################################################################
  74. # System independent
  75. #####################################################################
  76. # Where are the include files ?
  77. INC=../inc
  78. PROCINC=../$(CPU)
  79. CFG=../cfg
  80. OBJPASDIR=../objpas
  81. # Get some defaults for Programs and OSes.
  82. # This will set the following variables :
  83. # inlinux indos COPY REPLACE DEL INSTALL INSTALLEXE MKDIR
  84. # It will also set OPT for cross-compilation, and add required options.
  85. # also checks for config file.
  86. # it expects INC PROCINC to be set !!
  87. include $(CFG)/makefile.cfg
  88. # Get the system independent include file names.
  89. # This will set the following variables :
  90. # SYSINCNAMES
  91. include $(INC)/makefile.inc
  92. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  93. # Get the processor dependent include file names.
  94. # This will set the following variables :
  95. # CPUINCNAMES
  96. include $(PROCINC)/makefile.cpu
  97. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  98. # Put system unit dependencies together.
  99. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  100. #####################################################################
  101. # System dependent
  102. #####################################################################
  103. # Check if we need C library.
  104. ifeq ($(LINK_TO_C),YES)
  105. override OPT:=$(OPT) -dCRTLIB
  106. endif
  107. # Smart linking requested ?
  108. ifeq ($(SMARTLINK),YES)
  109. # no use with shared libs.
  110. ifneq ($(LIBNAME),)
  111. ifneq ($(LIBTYPE),shared)
  112. override OPT:=$(OPT) -Xl
  113. endif
  114. else
  115. override OPT:=$(OPT) -Xl
  116. endif
  117. endif
  118. ifneq ($(LIBNAME),)
  119. override OPT:=$(OPT) -o$(LIBNAME)
  120. ifeq ($(LIBTYPE),shared)
  121. override OPT:=$(OPT) -CD
  122. else
  123. override OPT:=$(OPT) -CS
  124. endif
  125. endif
  126. # Define Linux Units
  127. SYSTEMPPU=syslinux$(PPUEXT)
  128. OBJECTS=strings linux objpas sysutils math\
  129. dos crt objects printer \
  130. getopts errors sockets graph\
  131. # Extra Syslinux Depends
  132. ifeq ($(LINK_TO_C),YES)
  133. SYSLINUXDEPS=lprt$(OEXT)
  134. else
  135. SYSLINUXDEPS=sysconst.inc systypes.inc syscalls.inc
  136. endif
  137. # Determine on what dos unit should depend.
  138. DOSDEPS = dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT)
  139. ifeq ($(LINK_TO_C),YES)
  140. DOSDEPS:=$(DOSDEPS) lprt$(OEXT)
  141. else
  142. DOSDEPS:=$(DOSDEPS) linux$(PPUEXT)
  143. endif
  144. # Which prt to use ?
  145. ifdef AOUT
  146. PRT=prt0
  147. else
  148. PRT=prt1
  149. endif
  150. LOADERAS=$(CPU)/$(PRT).as
  151. CLOADERAS=$(CPU)/c$(PRT).as
  152. GLOADERAS=$(CPU)/g$(PRT).as
  153. # Define Loaders
  154. ifeq ($(LINK_TO_C),NO)
  155. LOADERS=prt0 cprt0 gprt0
  156. else
  157. LOADERS=lprt
  158. endif
  159. # Add Prefix and Suffixes
  160. OBJLOADERS=$(addsuffix $(OEXT), $(LOADERS))
  161. PPUOBJECTS=$(addsuffix $(PPUEXT), $(OBJECTS))
  162. .PHONY : all install clean \
  163. libs libsclean \
  164. diffs diffclean \
  165. all : $(OBJLOADERS) $(PPUOBJECTS)
  166. install : all
  167. $(MKDIR) $(UNITINSTALLDIR)
  168. $(INSTALL) *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)
  169. clean :
  170. -$(DEL) *$(OEXT) *$(ASMEXT) *$(PPUEXT) *.PPS log
  171. #####################################################################
  172. # Files
  173. #####################################################################
  174. #
  175. # Loaders
  176. #
  177. prt0$(OEXT) : $(LOADERAS)
  178. -as $(LOADERAS) -o prt0$(OEXT)
  179. cprt0$(OEXT) : $(CLOADERAS)
  180. -as $(CLOADERAS) -o cprt0$(OEXT)
  181. gprt0$(OEXT) : $(GLOADERAS)
  182. -as $(GLOADERAS) -o gprt0$(OEXT)
  183. lprt$(OEXT) : lprt.c
  184. gcc $(AOUT) -c lprt.c -o lprt$(OEXT)
  185. #
  186. # Base Units (System, strings, os-dependent-base-unit)
  187. #
  188. $(SYSTEMPPU) : syslinux.pp $(SYSLINUXDEPS) $(SYSDEPS)
  189. $(PP) $(OPT) -Us -Sg syslinux.pp $(REDIR)
  190. strings$(PPUEXT) : $(PROCINC)/strings.pp $(SYSTEMPPU)
  191. $(COPY) $(PROCINC)/strings.pp .
  192. $(PP) $(OPT) strings $(REDIR)
  193. $(DEL) strings.pp
  194. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  195. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  196. $(PP) $(OPT) linux.pp $(REDIR)
  197. #
  198. # Delphi Object Model
  199. #
  200. objpas$(PPUEXT) : $(OBJPASDIR)/objpas.pp $(SYSTEMPPU)
  201. $(COPY) $(OBJPASDIR)/objpas.pp .
  202. $(PP) $(OPT) objpas $(REDIR)
  203. $(DEL) objpas.pp
  204. sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(SYSTEMPPU) objpas$(PPUEXT) \
  205. dos$(PPUEXT)
  206. $(COPY) $(OBJPASDIR)/sysutils.pp .
  207. $(PP) $(OPT) -I$(OBJPASDIR) sysutils $(REDIR)
  208. $(DEL) sysutils.pp
  209. math$(PPUEXT) : $(OBJPASDIR)/math.pp $(SYSTEMPPU) objpas$(PPUEXT) \
  210. dos$(PPUEXT)
  211. $(COPY) $(OBJPASDIR)/math.pp .
  212. $(PP) $(OPT) -I$(OBJPASDIR) math $(REDIR)
  213. $(DEL) math.pp
  214. #
  215. # System Dependent Units
  216. #
  217. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  218. linux$(PPUEXT) $(SYSTEMPPU)
  219. $(PP) $(OPT) sockets.pp $(REDIR)
  220. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  221. $(PP) $(OPT) errors.pp $(REDIR)
  222. #
  223. # TP7 Compatible RTL Units
  224. #
  225. dos$(PPUEXT) : $(DOSDEPS) $(SYSTEMPPU)
  226. $(PP) $(OPT) dos $(REDIR)
  227. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc $(INC)/filerec.inc linux$(PPUEXT)\
  228. $(SYSTEMPPU)
  229. $(PP) $(OPT) crt $(REDIR)
  230. objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
  231. $(COPY) $(INC)/objects.pp .
  232. $(PP) $(OPT) objects $(REDIR)
  233. $(DEL) objects.pp
  234. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  235. $(PP) $(OPT) printer $(REDIR)
  236. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  237. $(PP) $(OPT) graph $(REDIR)
  238. #
  239. # Other RTL Units
  240. #
  241. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  242. $(COPY) $(INC)/getopts.pp .
  243. $(PP) $(OPT) getopts $(REDIR)
  244. $(DEL) getopts.pp
  245. #####################################################################
  246. # Libs
  247. #####################################################################
  248. libs : all libfpc$(LIBEXT)
  249. libfpc.so:
  250. $(PPUMOVE) -o fpc *.ppu
  251. libfpc.a:
  252. $(PPUMOVE) -s -o fpc *.ppu
  253. libinstall : libs
  254. $(INSTALLEXE) libfpc$(LIBEXT) $(LIBINSTALLDIR)
  255. $(INSTALL) *$(PPLEXT) $(UNITINSTALLDIR)
  256. ldconfig
  257. libsclean : clean
  258. -$(DEL) *.a *.so *$(PPLEXT)
  259. #####################################################################
  260. # Default targets
  261. #####################################################################
  262. include $(CFG)/makefile.def
  263. #
  264. # $Log$
  265. # Revision 1.18 1998-08-16 10:22:57 michael
  266. # Added library support, and smartlinking
  267. #
  268. # Revision 1.17 1998/08/15 17:08:09 peter
  269. # + support for cprt0.o
  270. #
  271. #