makefile 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. # makes the SYSTEM-Unit for Linux
  2. #
  3. # Copyright (c) 1996 by Michael Van Canneyt
  4. #####################################################################
  5. # Start of configurable section.
  6. # Please note that all these must be set in the main makefile, and
  7. # should be set there.
  8. # Don't remove the indef statements. They serve to avoid conflicts
  9. # with the main makefile.
  10. #####################################################################
  11. # AOUT should be defined in main makefile.
  12. # But you can set it here too.
  13. # AOUT = -DAOUT
  14. # set the directory where to install the units.
  15. ifndef UNITINSTALLDIR
  16. UNITINSTALLDIR=/usr/lib/ppc/0.99.0
  17. endif
  18. # set the directory where to install the libs (must exist)
  19. ifndef LIBINSTALLDIR
  20. LIBINSTALLDIR=/usr/lib
  21. endif
  22. # Do you want to link to the C library ?
  23. # Standard it is NO. You can set it to YES to link in th C library.
  24. ifndef LINK_TO_C
  25. LINK_TO_C=NO
  26. endif
  27. # What is the Operating System ?
  28. ifndef OS_SRC
  29. OS_SRC=linux
  30. endif
  31. # What is the target operating system ?
  32. ifndef OS_TARGET
  33. OS_TARGET=linux
  34. endif
  35. # What is the target processor :
  36. ifndef CPU
  37. CPU=i386
  38. #CPU=m68k
  39. endif
  40. # What compiler to use ?
  41. ifndef PP
  42. PP=ppc386
  43. endif
  44. # What options to pass to the compiler ?
  45. # You may want to specify a config file or error definitions file here.
  46. ifndef OPT
  47. OPT=
  48. endif
  49. # Where is the PPUMOVE program ?
  50. ifndef PPUMOVE
  51. PPUMOVE=ppumove
  52. endif
  53. # Set this to 'shared' or 'static'
  54. LIBTYPE=shared
  55. #####################################################################
  56. # End of configurable section.
  57. # Do not edit after this line.
  58. #####################################################################
  59. # Where are the include files ?
  60. INC=../inc
  61. PROCINC=../$(CPU)
  62. # add required options...
  63. override OPT:= $(OPT) -d$(CPU)
  64. ifeq ($(OS_TARGET),$(OS_SRC))
  65. CROSSCOMPILE=NO
  66. else
  67. CROSSCOMPILE=YES
  68. endif
  69. # To copy pograms
  70. ifndef COPY
  71. ifeq ($(DOS),YES)
  72. COPY=copy
  73. else
  74. COPY=cp -p
  75. endif
  76. endif
  77. # Check delete program
  78. ifndef DEL
  79. ifeq ($(DOS),YES)
  80. DEL=del
  81. else
  82. DEL=rm -f
  83. endif
  84. endif
  85. # To install programs
  86. ifndef INSTALL
  87. ifeq ($(DOS),YES)
  88. INSTALL=copy
  89. else
  90. INSTALL=install
  91. endif
  92. endif
  93. # To make a directory.
  94. ifndef MKDIR
  95. ifeq ($(DOS),YES)
  96. MKDIR=mkdir
  97. else
  98. MKDIR=install -m 755 -d
  99. endif
  100. endif
  101. # diff program
  102. ifndef REFPATH
  103. REFPATH=/usr/local/fpk/work/new/rtl
  104. endif
  105. ifndef DIFF
  106. DIFF=diff
  107. endif
  108. ifndef DIFFOPTS
  109. DIFFOPTS=-b -c
  110. endif
  111. # Was a config file specified ?
  112. ifdef CFGFILE
  113. override OPT:=$(OPT) @$(CONFIG)
  114. endif
  115. # Check for crosscompile
  116. ifeq ($(CROSSCOMPILE),YES)
  117. override OPT:= $(OPT) -dCROSSCOMPILE -TLINUX
  118. endif
  119. # Check if we need C library.
  120. ifeq ($(LINK_TO_C),YES)
  121. override OPT:=$(OPT) -dCRTLIB
  122. endif
  123. # check whether we make shared or static libs
  124. ifndef LIBTYPE
  125. LIBTYPE=shared
  126. endif
  127. # determine libary extension.
  128. ifeq ($(LIBTYPE),static)
  129. LIBEXT=.a
  130. else
  131. LIBEXT=.so
  132. endif
  133. # determine needed extensions.
  134. PPUEXT=.ppu
  135. PPLEXT=.ppl
  136. OEXT=.o
  137. OBJECTS=syslinux strings dos objects linux crt printer getopts errors sockets
  138. PPUOBJECTS=$(addsuffix $(PPUEXT), $(OBJECTS))
  139. ifeq ($(LINK_TO_C),NO)
  140. PPUOBJECTS:= prt0$(OEXT) gprt0$(OEXT) $(PPUOBJECTS)
  141. endif
  142. # os independent depends
  143. SYSTEMDEPS=system.inc systemh.inc mathh.inc real2str.inc \
  144. heaph.inc innr.inc sstrings.inc file.inc \
  145. text.inc typefile.inc version.inc filerec.inc \
  146. textrec.inc objpas.inc objpash.inc \
  147. DSYSTEMDEPS=$(addprefix $(INC)/, $(SYSTEMDEPS))
  148. ifeq ($(LINK_TO_C),YES)
  149. SYSLINUXDEPS=lprt$(OEXT)
  150. else
  151. SYSLINUXDEPS=sysconst.inc systypes.inc syscalls.inc
  152. endif
  153. SYSPROCDEPS=math.inc set.inc heap.inc $(CPU).inc
  154. DSYSPROCDEPS=$(addprefix $(PROCINC)/, $(SYSPROCDEPS))
  155. # Determine on what dos unit should depend.
  156. DOSDEPS = dos.pp $(INC)/filerec.inc syslinux$(PPUEXT) strings$(PPUEXT)
  157. ifeq ($(LINK_TO_C),YES)
  158. DOSDEPS:=$(DOSDEPS) lprt$(OEXT)
  159. else
  160. DOSDEPS:=$(DOSDEPS) linux$(PPUEXT)
  161. endif
  162. # Which prt to use ?
  163. ifdef AOUT
  164. PRT=prt0.as
  165. else
  166. PRT=prt1.as
  167. endif
  168. .PHONY : all clean diffs install diffclean libs libsclean realclean
  169. all : $(PPUOBJECTS)
  170. syslinux$(PPUEXT) : syslinux.pp $(SYSLINUXDEPS) $(DSYSTEMDEPS) $(DSYSPROCDEPS)
  171. $(COPY) $(DSYSTEMDEPS) $(DSYSPROCDEPS) .
  172. $(PP) $(OPT) -Us -Sg syslinux $(REDIR)
  173. $(DEL) $(SYSTEMDEPS) $(SYSPROCDEPS)
  174. dos$(PPUEXT) : $(DOSDEPS)
  175. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  176. $(PP) $(OPT) dos $(REDIR)
  177. $(DEL) filerec.inc textrec.inc
  178. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc $(INC)/filerec.inc linux$(PPUEXT)\
  179. syslinux$(PPUEXT)
  180. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  181. $(PP) $(OPT) crt $(REDIR)
  182. $(DEL) filerec.inc textrec.inc
  183. lprt$(OEXT) : lprt.c
  184. gcc $(AOUT) -c lprt.c -o lprt$(OEXT)
  185. getopts$(PPUEXT) : $(PROCINC)/getopts.pp syslinux$(PPUEXT)
  186. $(COPY) $(PROCINC)/getopts.pp .
  187. $(PP) $(OPT) getopts $(REDIR)
  188. $(DEL) getopts.pp
  189. strings$(PPUEXT) : $(PROCINC)/strings.pp syslinux$(PPUEXT)
  190. $(COPY) $(PROCINC)/strings.pp .
  191. $(PP) $(OPT) strings $(REDIR)
  192. $(DEL) strings.pp
  193. objects$(PPUEXT) : objects.pp syslinux$(PPUEXT)
  194. $(PP) $(OPT) objects $(REDIR)
  195. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) syslinux$(PPUEXT)
  196. $(COPY) $(INC)/textrec.inc .
  197. $(PP) $(OPT) printer $(REDIR)
  198. $(DEL) textrec.inc
  199. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc\
  200. syscalls.inc systypes.inc sysconst.inc syslinux$(PPUEXT)
  201. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  202. $(PP) $(OPT) linux.pp $(REDIR)
  203. $(DEL) filerec.inc textrec.inc
  204. sockets$(PPUEXT) : sockets.pp linux.ppu $(INC)/textrec.inc $(INC)/filerec.inc
  205. $(COPY) $(INC)/filerec.inc $(INC)/textrec.inc .
  206. $(PP) $(OPT) sockets.pp $(REDIR)
  207. $(DEL) filerec.inc textrec.inc
  208. errors$(PPUEXT) : errors.pp strings.ppu
  209. $(PP) $(OPT) errors.pp $(REDIR)
  210. prt0$(OEXT) : $(PRT)
  211. -as $(PRT) -o prt0$(OEXT)
  212. gprt0$(OEXT) : gprt1.as
  213. -as gprt1.as -o gprt0$(OEXT)
  214. libs : all libfpc$(LIBEXT)
  215. libfpc.so:
  216. $(PPUMOVE) -o fpc *.ppu
  217. libfpc.a:
  218. $(PPUMOVE) -s -o fpc *.ppu
  219. install : all
  220. $(MKDIR) $(UNITINSTALLDIR)/linuxunits
  221. $(INSTALL) -m 644 *$(PPUEXT) *$(OEXT) $(UNITINSTALLDIR)/linuxunits
  222. libinstall : libs
  223. $(INSTALL) -m 755 libfpc$(LIBEXT) $(LIBINSTALLDIR)
  224. $(INSTALL) -m 644 *$(PPLEXT) $(UNITINSTALLDIR)/linuxunits
  225. clean :
  226. -$(DEL) *$(OEXT)
  227. -$(DEL) *.s
  228. -$(DEL) *$(PPUEXT)
  229. -$(DEL) *.dif
  230. -$(DEL) *.PPS
  231. -$(DEL) log
  232. libsclean : clean
  233. -$(DEL) *.a *.so *$(PPLEXT)
  234. diffclean :
  235. -$(DEL) *.dif
  236. distclean : diffclean libsclean clean
  237. %.dif : %.pp
  238. -$(DIFF) $(DIFFOPTS) $*.pp $(REFPATH)/linux/$*.pp >$*.dif
  239. %.dif : %.inc
  240. -$(DIFF) $(DIFFOPTS) $*.inc $(REFPATH)/linux/$*.inc >$*.dif
  241. %.dif : %.as
  242. -$(DIFF) $(DIFFOPTS) $*.s $(REFPATH)/linux/$*.s >$*.dif
  243. makefile.dif : makefile
  244. -$(DIFF) $(DIFFOPTS) makefile $(REFPATH)/linux/makefile > makefile.dif
  245. diffs : dos.dif syslinux.dif objects.dif errno.dif prt0.dif prt1.dif \
  246. objects.dif linux.dif printer.dif os.dif syscalls.dif sysnr.dif \
  247. makefile.dif