makefile 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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. # set the directory where to install the units.
  23. ifndef UNITINSTALLDIR
  24. UNITINSTALLDIR=/usr/lib/fpc/0.99.6/linuxunits
  25. endif
  26. # set the directory where to install the libs (must exist)
  27. ifndef LIBINSTALLDIR
  28. LIBINSTALLDIR=/usr/lib
  29. endif
  30. # What is the Operating System ?
  31. ifndef OS_SRC
  32. OS_SRC=linux
  33. endif
  34. # What is the target operating system ?
  35. ifndef OS_TARGET
  36. OS_TARGET=linux
  37. endif
  38. # What is the target processor :
  39. ifndef CPU
  40. CPU=i386
  41. #CPU=m68k
  42. endif
  43. # What compiler to use ?
  44. ifndef PP
  45. PP=ppc386
  46. endif
  47. # What options to pass to the compiler ?
  48. # You may want to specify a config file or error definitions file here.
  49. ifndef OPT
  50. OPT=
  51. endif
  52. # Where is the PPUMOVE program ?
  53. ifndef PPUMOVE
  54. PPUMOVE=ppumove
  55. endif
  56. # Set this to 'shared' or 'static'
  57. LIBTYPE=shared
  58. # AOUT should be defined in main makefile.
  59. # But you can set it here too.
  60. # AOUT = -DAOUT
  61. # Do you want to link to the C library ?
  62. # Standard it is NO. You can set it to YES to link in th C library.
  63. ifndef LINK_TO_C
  64. LINK_TO_C=NO
  65. endif
  66. #####################################################################
  67. # End of configurable section.
  68. # Do not edit after this line.
  69. #####################################################################
  70. # Where are the include files ?
  71. INC=../inc
  72. PROCINC=../$(CPU)
  73. OBJPASDIR=../objpas
  74. # To copy pograms
  75. ifndef COPY
  76. ifeq ($(DOS),YES)
  77. COPY=copy
  78. else
  79. COPY=cp -p
  80. endif
  81. endif
  82. # Check delete program
  83. ifndef DEL
  84. ifeq ($(DOS),YES)
  85. DEL=del
  86. else
  87. DEL=rm -f
  88. endif
  89. endif
  90. # To install files
  91. ifndef INSTALL
  92. ifeq ($(DOS),YES)
  93. INSTALL=copy
  94. else
  95. INSTALL=install -m 644
  96. endif
  97. endif
  98. # To install programs
  99. ifndef INSTALLEXE
  100. ifeq ($(DOS),YES)
  101. INSTALLEXE=copy
  102. else
  103. INSTALLEXE=install -m 755
  104. endif
  105. endif
  106. # To make a directory.
  107. ifndef MKDIR
  108. ifeq ($(DOS),YES)
  109. MKDIR=mkdir
  110. else
  111. MKDIR=install -m 755 -d
  112. endif
  113. endif
  114. # diff program
  115. ifndef REFPATH
  116. REFPATH=/usr/local/fpk/work/new/rtl
  117. endif
  118. ifndef DIFF
  119. DIFF=diff
  120. endif
  121. ifndef DIFFOPTS
  122. DIFFOPTS=-b -c
  123. endif
  124. #
  125. # System independent Commandline Options
  126. #
  127. # Cross compiling ?
  128. ifeq ($(OS_TARGET),$(OS_SRC))
  129. CROSSCOMPILE=NO
  130. else
  131. CROSSCOMPILE=YES
  132. endif
  133. # add required options... (-dFPC is required for older versions)
  134. override OPT:= $(OPT) -dFPC -d$(CPU)
  135. # Was a config file specified ?
  136. ifdef CFGFILE
  137. override OPT:=$(OPT) @$(CFGFILE)
  138. endif
  139. # Check for crosscompile
  140. ifeq ($(CROSSCOMPILE),YES)
  141. override OPT:= $(OPT) -dCROSSCOMPILE -T$(OS_TARGET)
  142. endif
  143. #
  144. # System dependent Commandline Options
  145. #
  146. # Check if we need C library.
  147. ifeq ($(LINK_TO_C),YES)
  148. override OPT:=$(OPT) -dCRTLIB
  149. endif
  150. #####################################################################
  151. # System dependent
  152. #####################################################################
  153. # check whether we make shared or static libs
  154. ifndef LIBTYPE
  155. LIBTYPE=shared
  156. endif
  157. # determine libary extension.
  158. ifeq ($(LIBTYPE),static)
  159. LIBEXT=.a
  160. else
  161. LIBEXT=.so
  162. endif
  163. # Determine needed extensions
  164. PPUEXT=.ppu
  165. PPLEXT=.ppl
  166. OEXT=.o
  167. ASMEXT=.s
  168. # Define Linux Units
  169. SYSTEMPPU=syslinux$(PPUEXT)
  170. OBJECTS=strings linux objpas \
  171. dos crt objects printer \
  172. getopts errors sockets graph\
  173. # Extra Syslinux Depends
  174. ifeq ($(LINK_TO_C),YES)
  175. SYSLINUXDEPS=lprt$(OEXT)
  176. else
  177. SYSLINUXDEPS=sysconst.inc systypes.inc syscalls.inc
  178. endif
  179. # Determine on what dos unit should depend.
  180. DOSDEPS = dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT)
  181. ifeq ($(LINK_TO_C),YES)
  182. DOSDEPS:=$(DOSDEPS) lprt$(OEXT)
  183. else
  184. DOSDEPS:=$(DOSDEPS) linux$(PPUEXT)
  185. endif
  186. # Which prt to use ?
  187. ifdef AOUT
  188. PRT=prt0
  189. else
  190. PRT=prt1
  191. endif
  192. LOADERAS=$(CPU)/$(PRT).as
  193. GLOADERAS=$(CPU)/g$(PRT).as
  194. # Define Loaders
  195. ifeq ($(LINK_TO_C),NO)
  196. LOADERS=prt0 gprt0
  197. else
  198. LOADERS=lprt
  199. endif
  200. #####################################################################
  201. # System independent Makefile
  202. #####################################################################
  203. # OS Independent Depends
  204. SYSTEMDEPS=system.inc systemh.inc mathh.inc real2str.inc \
  205. heaph.inc innr.inc sstrings.inc file.inc
  206. SYSTEMDEPS2=text.inc typefile.inc version.inc filerec.inc \
  207. textrec.inc
  208. # Processor Dependent Depends
  209. SYSPROCDEPS=math.inc set.inc heap.inc $(CPU).inc
  210. # Add Prefix and Suffixes
  211. OBJLOADERS=$(addsuffix $(OEXT), $(LOADERS))
  212. PPUOBJECTS=$(addsuffix $(PPUEXT), $(OBJECTS))
  213. DSYSTEMDEPS=$(addprefix $(INC)/, $(SYSTEMDEPS))
  214. DSYSTEMDEPS2=$(addprefix $(INC)/, $(SYSTEMDEPS2))
  215. DSYSPROCDEPS=$(addprefix $(PROCINC)/, $(SYSPROCDEPS))
  216. .PHONY : all install clean \
  217. libs libsclean \
  218. diffs diffclean \
  219. all : $(OBJLOADERS) $(PPUOBJECTS)
  220. install : all
  221. $(MKDIR) $(UNITINSTALLDIR)
  222. $(INSTALL) *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)
  223. clean :
  224. -$(DEL) *$(OEXT) *$(ASMEXT) *$(PPUEXT) *.PPS log
  225. #####################################################################
  226. # Files
  227. #####################################################################
  228. #
  229. # Loaders
  230. #
  231. prt0$(OEXT) : $(LOADERAS)
  232. -as $(LOADERAS) -o prt0$(OEXT)
  233. gprt0$(OEXT) : $(GLOADERAS)
  234. -as $(GLOADERAS) -o gprt0$(OEXT)
  235. lprt$(OEXT) : lprt.c
  236. gcc $(AOUT) -c lprt.c -o lprt$(OEXT)
  237. #
  238. # Base Units (System, strings, os-dependent-base-unit)
  239. #
  240. $(SYSTEMPPU) : syslinux.pp $(SYSLINUXDEPS) $(DSYSTEMDEPS) $(DSYSPROCDEPS)
  241. $(COPY) $(DSYSTEMDEPS) .
  242. $(COPY) $(DSYSTEMDEPS2) .
  243. $(COPY) $(DSYSPROCDEPS) .
  244. $(PP) $(OPT) -Us -Sg syslinux.pp $(REDIR)
  245. $(DEL) $(SYSTEMDEPS)
  246. $(DEL) $(SYSTEMDEPS2)
  247. $(DEL) $(SYSPROCDEPS)
  248. strings$(PPUEXT) : $(PROCINC)/strings.pp $(SYSTEMPPU)
  249. $(COPY) $(PROCINC)/strings.pp .
  250. $(PP) $(OPT) strings $(REDIR)
  251. $(DEL) strings.pp
  252. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  253. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  254. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  255. $(PP) $(OPT) linux.pp $(REDIR)
  256. $(DEL) filerec.inc textrec.inc
  257. #
  258. # Delphi Object Model
  259. #
  260. objpas$(PPUEXT) : $(OBJPASDIR)/objpas.pp $(SYSTEMPPU)
  261. $(COPY) $(OBJPASDIR)/objpas.pp .
  262. $(PP) $(OPT) objpas $(REDIR)
  263. $(DEL) objpas.pp
  264. #
  265. # System Dependent Units
  266. #
  267. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  268. linux$(PPUEXT) $(SYSTEMPPU)
  269. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  270. $(PP) $(OPT) sockets.pp $(REDIR)
  271. $(DEL) filerec.inc textrec.inc
  272. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  273. $(PP) $(OPT) errors.pp $(REDIR)
  274. #
  275. # TP7 Compatible RTL Units
  276. #
  277. dos$(PPUEXT) : $(DOSDEPS) $(SYSTEMPPU)
  278. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  279. $(PP) $(OPT) dos $(REDIR)
  280. $(DEL) filerec.inc textrec.inc
  281. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc $(INC)/filerec.inc linux$(PPUEXT)\
  282. $(SYSTEMPPU)
  283. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  284. $(PP) $(OPT) crt $(REDIR)
  285. $(DEL) filerec.inc textrec.inc
  286. objects$(PPUEXT) : objects.pp $(SYSTEMPPU)
  287. $(PP) $(OPT) objects $(REDIR)
  288. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  289. $(COPY) $(INC)/textrec.inc .
  290. $(PP) $(OPT) printer $(REDIR)
  291. $(DEL) textrec.inc
  292. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  293. $(PP) $(OPT) graph $(REDIR)
  294. #
  295. # Other RTL Units
  296. #
  297. getopts$(PPUEXT) : $(PROCINC)/getopts.pp $(SYSTEMPPU)
  298. $(COPY) $(PROCINC)/getopts.pp .
  299. $(PP) $(OPT) getopts $(REDIR)
  300. $(DEL) getopts.pp
  301. #####################################################################
  302. # Libs
  303. #####################################################################
  304. libs : all libfpc$(LIBEXT)
  305. libfpc.so:
  306. $(PPUMOVE) -o fpc *.ppu
  307. libfpc.a:
  308. $(PPUMOVE) -s -o fpc *.ppu
  309. libinstall : libs
  310. $(INSTALLEXE) libfpc$(LIBEXT) $(LIBINSTALLDIR)
  311. $(INSTALL) *$(PPLEXT) $(UNITINSTALLDIR)
  312. libsclean : clean
  313. -$(DEL) *.a *.so *$(PPLEXT)
  314. #####################################################################
  315. # Diffs
  316. #####################################################################
  317. %.dif : %.pp
  318. -$(DIFF) $(DIFFOPTS) $*.pp $(REFPATH)/linux/$*.pp >$*.dif
  319. %.dif : %.inc
  320. -$(DIFF) $(DIFFOPTS) $*.inc $(REFPATH)/linux/$*.inc >$*.dif
  321. %.dif : %.as
  322. -$(DIFF) $(DIFFOPTS) $*.s $(REFPATH)/linux/$*.s >$*.dif
  323. diffclean :
  324. -$(DEL) *.dif
  325. makefile.dif : makefile
  326. -$(DIFF) $(DIFFOPTS) makefile $(REFPATH)/linux/makefile > makefile.dif
  327. diffs : dos.dif syslinux.dif objects.dif errno.dif prt0.dif prt1.dif \
  328. objects.dif linux.dif printer.dif os.dif syscalls.dif sysnr.dif \
  329. makefile.dif
  330. #####################################################################
  331. # Distribution
  332. #####################################################################
  333. distclean : clean libsclean diffclean