Makefile 9.5 KB

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