Makefile 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. # Warning: this file contains TAB (#9) characters that are required for
  16. # make. Make sure you use an editor that does not replace TABs with
  17. # spaces, or the makefile won't work anymore after you save.
  18. #####################################################################
  19. # Start of configurable section.
  20. # Please note that all these must be set in the main makefile, and
  21. # should be set there.
  22. # Don't remove the indef statements. They serve to avoid conflicts
  23. # with the main makefile.
  24. #####################################################################
  25. # What is the Operating System ?
  26. ifndef OS_SOURCE
  27. OS_SOURCE=linux
  28. endif
  29. # What is the target operating system ?
  30. ifndef OS_TARGET
  31. OS_TARGET=linux
  32. endif
  33. # What is the target processor :
  34. ifndef CPU
  35. CPU=i386
  36. #CPU=m68k
  37. endif
  38. # Use smartlinking ?
  39. ifndef SMARTLINK
  40. SMARTLINK=NO
  41. endif
  42. # Name of library ?
  43. # If this is set, all units will be put in the same library.
  44. # If it is empty (default), the units will be left in separate files.
  45. ifndef LIBNAME
  46. LIBNAME=
  47. #LIBNAME=fpc
  48. endif
  49. # Should the library be shared or static (only if LIBNAME is set).
  50. # Set this to 'shared' or 'static' to create a librrary
  51. # Setting this to shared will disable smart linking.
  52. ifndef LIBTYPE
  53. LIBTYPE=
  54. #LIBTYPE=static
  55. endif
  56. # What compiler to use ?
  57. ifndef PP
  58. PP=ppc386
  59. endif
  60. # What options to pass to the compiler ?
  61. # You may want to specify a config file or error definitions file here.
  62. ifndef OPT
  63. OPT=
  64. endif
  65. # Where is the PPUMOVE program ?
  66. ifndef PPUMOVE
  67. PPUMOVE=ppumove
  68. endif
  69. # AOUT should be defined in main makefile.
  70. # But you can set it here too.
  71. # AOUT = -DAOUT
  72. # Do you want to link to the C library ?
  73. # Standard it is NO. You can set it to YES to link in th C library.
  74. ifndef LINK_TO_C
  75. LINK_TO_C=NO
  76. endif
  77. #####################################################################
  78. # End of configurable section.
  79. # Do not edit after this line.
  80. #####################################################################
  81. #####################################################################
  82. # System independent
  83. #####################################################################
  84. # Check if we need C library.
  85. ifeq ($(LINK_TO_C),YES)
  86. override OPT+=-dCRTLIB
  87. endif
  88. # Where are the include files
  89. RTL=..
  90. CFG=$(RTL)/cfg
  91. INC=$(RTL)/inc
  92. PROCINC=$(RTL)/$(CPU)
  93. OBJPASDIR=$(RTL)/objpas
  94. # Where to place the resuts
  95. TARGETDIR=.
  96. # Get some defaults for Programs and OSes.
  97. # This will set the following variables :
  98. # inlinux indos COPY REPLACE DEL INSTALL INSTALLEXE MKDIR
  99. # It will also set OPT for cross-compilation, and add required options.
  100. # also checks for config file.
  101. # it expects INC PROCINC to be set !!
  102. include $(CFG)/makefile.cfg
  103. # Get the system independent include file names.
  104. # This will set the following variables :
  105. # SYSINCNAMES
  106. include $(INC)/makefile.inc
  107. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  108. # Get the processor dependent include file names.
  109. # This will set the following variables :
  110. # CPUINCNAMES
  111. include $(PROCINC)/makefile.cpu
  112. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  113. # Put system unit dependencies together.
  114. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  115. #####################################################################
  116. # System dependent
  117. #####################################################################
  118. # Define Linux Units
  119. SYSTEMPPU=syslinux$(PPUEXT)
  120. OBJECTS=strings linux \
  121. dos crt objects printer ports \
  122. objpas sysutils typinfo \
  123. cpu mmx getopts heaptrc ports \
  124. errors sockets graph
  125. # Which units may be placed in the shared lib file
  126. SHAREDLIBFILES=syslinux strings linux objpas sysutils math \
  127. dos crt objects printer \
  128. getopts errors sockets ports
  129. # Extra Syslinux Depends
  130. ifeq ($(LINK_TO_C),YES)
  131. SYSLINUXDEPS=lprt$(OEXT)
  132. else
  133. SYSLINUXDEPS=sysconst.inc systypes.inc syscalls.inc
  134. endif
  135. # Determine on what dos unit should depend.
  136. DOSDEPS = dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT)
  137. ifeq ($(LINK_TO_C),YES)
  138. DOSDEPS:=$(DOSDEPS) lprt$(OEXT)
  139. else
  140. DOSDEPS:=$(DOSDEPS) linux$(PPUEXT)
  141. endif
  142. # Which prt to use ?
  143. ifdef AOUT
  144. PRT=prt0
  145. else
  146. PRT=prt1
  147. endif
  148. LOADERAS=$(CPU)/$(PRT).as
  149. CLOADERAS=$(CPU)/c$(PRT).as
  150. GLOADERAS=$(CPU)/g$(PRT).as
  151. # Define Loaders
  152. ifeq ($(LINK_TO_C),NO)
  153. LOADERS=prt0 cprt0 gprt0
  154. else
  155. LOADERS=lprt
  156. endif
  157. # Add Prefix and Suffixes
  158. OBJLOADERS=$(addsuffix $(OEXT), $(LOADERS))
  159. PPUOBJECTS=$(SYSTEMPPU) $(addsuffix $(PPUEXT), $(OBJECTS))
  160. .PHONY : all install clean \
  161. libs libsclean \
  162. diffs diffclean \
  163. all : $(OBJLOADERS) $(PPUOBJECTS)
  164. install : all
  165. $(MKDIR) $(UNITINSTALLDIR)
  166. $(INSTALL) *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)
  167. clean :
  168. -$(DEL) *$(OEXT) *$(ASMEXT) *$(PPUEXT) $(PPAS) link.res log
  169. -$(DELTREE) *$(SMARTEXT)
  170. #####################################################################
  171. # Files
  172. #####################################################################
  173. #
  174. # Loaders
  175. #
  176. prt0$(OEXT) : $(LOADERAS)
  177. -as $(LOADERAS) -o prt0$(OEXT)
  178. cprt0$(OEXT) : $(CLOADERAS)
  179. -as $(CLOADERAS) -o cprt0$(OEXT)
  180. gprt0$(OEXT) : $(GLOADERAS)
  181. -as $(GLOADERAS) -o gprt0$(OEXT)
  182. lprt$(OEXT) : lprt.c
  183. gcc $(AOUT) -c lprt.c -o lprt$(OEXT)
  184. #
  185. # Base Units (System, strings, os-dependent-base-unit)
  186. #
  187. $(SYSTEMPPU) : syslinux.pp $(SYSLINUXDEPS) $(SYSDEPS)
  188. $(COMPILER) -Us -Sg syslinux.pp $(REDIR)
  189. strings$(PPUEXT) : $(PROCINC)/strings.pp $(SYSTEMPPU)
  190. $(COMPILER) $(PROCINC)/strings.pp $(REDIR)
  191. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  192. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  193. $(COMPILER) linux.pp $(REDIR)
  194. #
  195. # Delphi Object Model
  196. #
  197. include $(OBJPASDIR)/makefile.op
  198. #
  199. # System Dependent Units
  200. #
  201. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  202. linux$(PPUEXT) $(SYSTEMPPU)
  203. $(COMPILER) sockets.pp $(REDIR)
  204. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  205. $(COMPILER) errors.pp $(REDIR)
  206. #
  207. # TP7 Compatible RTL Units
  208. #
  209. dos$(PPUEXT) : $(DOSDEPS) $(SYSTEMPPU)
  210. $(COMPILER) dos.pp $(REDIR)
  211. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  212. $(COMPILER) crt.pp $(REDIR)
  213. objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
  214. $(COMPILER) $(INC)/objects.pp $(REDIR)
  215. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  216. $(COMPILER) printer.pp $(REDIR)
  217. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  218. $(COMPILER) graph.pp $(REDIR)
  219. ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
  220. $(COMPILER) ports.pp $(REDIR)
  221. #
  222. # Other RTL Units
  223. #
  224. cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)
  225. $(COMPILER) $(PROCINC)/cpu.pp $(REDIR)
  226. mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)
  227. $(COMPILER) $(PROCINC)/mmx.pp $(REDIR)
  228. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  229. $(COMPILER) $(INC)/getopts.pp $(REDIR)
  230. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
  231. $(COMPILER) $(INC)/heaptrc $(REDIR)
  232. #####################################################################
  233. # Libs
  234. #####################################################################
  235. libs: staticlib sharedlib
  236. staticlib:
  237. make clean
  238. make all SMARTLINK=YES LIBNAME=fpc LIBTYPE=static
  239. sharedlib:
  240. make clean
  241. make all
  242. $(PPUMOVE) -ofpc $(SHAREDLIBFILES)
  243. staticlibinstall: staticlib
  244. $(MKDIR) $(STATIC_LIBINSTALLDIR)
  245. $(MKDIR) $(STATIC_UNITINSTALLDIR)
  246. $(INSTALLEXE) libfpc$(STATICLIBEXT) $(STATIC_LIBINSTALLDIR)
  247. $(INSTALL) *$(PPUEXT) $(OBJLOADERS) $(STATIC_UNITINSTALLDIR)
  248. sharedlibinstall: sharedlib
  249. $(MKDIR) $(SHARED_LIBINSTALLDIR)
  250. $(MKDIR) $(SHARED_UNITINSTALLDIR)
  251. $(INSTALLEXE) libfpc$(SHAREDLIBEXT) $(SHARED_LIBINSTALLDIR)
  252. $(INSTALL) *$(PPUEXT) $(OBJLOADERS) $(SHARED_UNITINSTALLDIR)
  253. $(LDCONFIG)
  254. libinstall: staticlibinstall sharedlibinstall
  255. libsclean : clean
  256. -$(DEL) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  257. #####################################################################
  258. # Default targets
  259. #####################################################################
  260. include $(CFG)/makefile.def
  261. #
  262. # $Log$
  263. # Revision 1.12 1998-12-21 13:07:05 peter
  264. # * use -FE
  265. #
  266. # Revision 1.11 1998/12/11 00:10:50 peter
  267. # * use $mode directive
  268. #
  269. # Revision 1.10 1998/12/07 16:38:48 michael
  270. # Added ports unit
  271. #
  272. # Revision 1.9 1998/11/24 19:50:49 jonas
  273. # + added warning about TABs
  274. #
  275. # Revision 1.8 1998/11/10 17:56:56 peter
  276. # * fixes to build correct again
  277. #
  278. # Revision 1.7 1998/10/11 13:47:21 michael
  279. # sysutils disk.inc
  280. #
  281. # Revision 1.6 1998/10/11 12:21:49 michael
  282. # + Further sysutils implementations.
  283. #
  284. # Revision 1.5 1998/10/06 22:10:31 peter
  285. # + heaptrc
  286. #
  287. # Revision 1.4 1998/10/02 09:26:01 peter
  288. # * fixed rtl path
  289. #
  290. # Revision 1.3 1998/09/15 12:09:10 peter
  291. # * merged updates
  292. #
  293. # Revision 1.2 1998/09/11 13:14:01 michael
  294. # many libs and libinstall fixes
  295. #
  296. # Revision 1.1.2.1 1998/09/15 12:02:04 peter
  297. # * updates to get objpas using its own makefile
  298. #
  299. # Revision 1.1 1998/09/10 14:15:49 peter
  300. # - renamed makefile to Makefile
  301. #
  302. # Revision 1.24 1998/09/10 09:10:05 michael
  303. # errors when making libs
  304. #
  305. # Revision 1.23 1998/09/07 18:31:53 peter
  306. # * fixed $smartlibext -> $staticlibext to fix a 'rm *' :(
  307. #
  308. # Revision 1.22 1998/08/21 20:20:12 michael
  309. # + Fixed spaces to tabs.
  310. #
  311. # Revision 1.21 1998/08/21 15:17:00 peter
  312. # * win32 compiles a bit better, no growheap crash
  313. #
  314. # Revision 1.20 1998/08/18 08:35:06 peter
  315. # * updated for new lib options
  316. #
  317. # Revision 1.19 1998/08/17 09:30:00 peter
  318. # * libtype/libname is by default off
  319. #
  320. # Revision 1.18 1998/08/16 10:22:57 michael
  321. # Added library support, and smartlinking
  322. #
  323. # Revision 1.17 1998/08/15 17:08:09 peter
  324. # + support for cprt0.o
  325. #
  326. #