makefile 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. #****************************************************************************
  2. #
  3. # Copyright (c) 1993,95 by Florian Klaempfl
  4. # Modified and enhanced for GNU make by
  5. # M. Van Canneyt and P. Muller
  6. #****************************************************************************
  7. #
  8. # The parameters are set in the main makefile.
  9. # here we specify the defaults.
  10. #############################
  11. # When compiling the compiler
  12. #############################
  13. # Try to determine Operating System
  14. BASEDIR:=$(shell pwd)
  15. # in linux no : in pathes
  16. ifeq ($(findstring, ':', $(BASEDIR)),)
  17. inlinux=1
  18. endif
  19. # in case pwd is not present on the DOS-OS
  20. ifeq ($(strip $(BASEDIR)),'')
  21. undef inlinux
  22. BASEDIR:=.
  23. endif
  24. # What compiler to use
  25. ifndef PP
  26. PP=ppc386
  27. endif
  28. # what target do we use
  29. # currently dos go32v2 os2 and linux are available
  30. ifdef inlinux
  31. TARGET=linux
  32. else
  33. TARGET=go32v2
  34. endif
  35. COMPILERDIR=$(BASEDIR)
  36. # What extra options to give to compiler ?
  37. # (Minimum options are added by the makefile itself)
  38. ifndef OPT
  39. # OPT= -g
  40. # for aout
  41. # OPT= -e/usr/i486-linuxaout/bin -a -Sg -OGa -g -q+ -w- -Up$(UNITDIR)
  42. endif
  43. # What processor do you want to compile for : i386 m68k (case sensitive !!)
  44. ifndef CPU
  45. CPU= i386
  46. # CPU= m68k
  47. endif
  48. RTLDIR:=$(BASEDIR)/../rtl
  49. # specify where units are.
  50. # This needs to be set correctly for the 'remake' target to work !
  51. ifndef UNITDIR
  52. UNITDIR=$(RTLDIR)/$(TARGET)
  53. #UNITDIR=/usr/lib/ppc/0.99.0/linuxunits
  54. # dos and go32v2 are special
  55. ifeq ($(TARGET),dos)
  56. UNITDIR=$(RTLDIR)/dos/go32v1
  57. endif
  58. ifeq ($(TARGET),go32v2)
  59. UNITDIR=$(RTLDIR)/dos/go32v2
  60. endif
  61. endif
  62. # not def UNITDIR
  63. # Where to install the executable program/link
  64. ifndef PROGINSTALLDIR
  65. ifdef inlinux
  66. PROGINSTALLDIR = /usr/local/bin
  67. else
  68. PROGINSTALLDIR = c:\pp\bin
  69. endif
  70. endif
  71. # Linux only : Where to install the _real_executable.
  72. ifndef LIBINSTALLDIR
  73. LIBINSTALLDIR = /usr/lib/ppc/0.99.0
  74. # for aout system
  75. # LIBINSTALLDIR = /usr/lib/ppc/aout/0.9.1
  76. endif
  77. # !!! Linux only
  78. # GCCLIBPATH is wat is it on my PC... it MUST be set in the main Makefile
  79. ifndef GCCLIBPATH
  80. GCCLIBPATH=/usr/lib/gcc-lib/i486-linux/2.6.3
  81. endif
  82. ##################################
  83. # When making diffs of the sources
  84. ##################################
  85. # Diff program
  86. DIFF = diff
  87. # Diff3 program
  88. DIFF3 = diff3
  89. # Options to diff.
  90. DIFFOPTS = -b -c
  91. # Directory where files are to make diffs with..
  92. ifdef inlinux
  93. DIFDIR = /usr/local/fpk/work/new/compiler
  94. else
  95. DIFDIR = h:/cvs/compiler
  96. endif
  97. # Directory where reference files are for diff3
  98. ifdef inlinux
  99. REFDIR = /usr/local/fpk/dist/source/compiler
  100. else
  101. REFDIR = h:/myref/compiler
  102. endif
  103. #####################################################################
  104. # End of configurable section. Do not edit after this line.
  105. #####################################################################
  106. # correct options with needed stuff
  107. PPOPTS:=$(OPT) -d$(CPU) -dGDB -dFPC -Sg
  108. ifneq ("$(UNITDIR)", "")
  109. PPOPTS:=$(PPOPTS) -Up$(UNITDIR)
  110. endif
  111. COMPILER = $(PP) $(PPOPTS)
  112. # Do we need the GCC library ?
  113. ifeq ($(LINK_TO_C),YES)
  114. COMPILER:=$(COMPILER) -Fg$(GCCLIBPATH)
  115. endif
  116. .SUFFIXES: .pas .exe .ppu .dif .d3p .d3i .d3m .new
  117. .PHONY : diff diff3 patch clean rtl toflor \
  118. test rtlzip remake3 remake cycle \
  119. info replacediff3 restorediff3
  120. .pas.ppu:
  121. $(COMPILER) $<
  122. .pas.exe:
  123. $(COMPILER) $<
  124. .pas:
  125. $(COMPILER) $<
  126. #
  127. # Default target makes the compiler.
  128. #
  129. ifeq ($(TARGET),linux)
  130. PPEXENAME=pp
  131. EXENAME=ppc386
  132. TEMPNAME=ppc
  133. TEMPNAME1=ppc1
  134. TEMPNAME2=ppc2
  135. TEMPNAME3=ppc3
  136. MAKEDEP=mkdep
  137. REPLACE=mv -f
  138. else
  139. PPEXENAME=pp.exe
  140. EXENAME=ppc386.exe
  141. TEMPNAME=ppc.exe
  142. TEMPNAME1=ppc1.exe
  143. TEMPNAME2=ppc2.exe
  144. TEMPNAME3=ppc3.exe
  145. MAKEDEP=mkdep.exe
  146. # DJGPP mv -f make problems under dos !!
  147. REPLACE=move /y
  148. endif
  149. CP=cp -f
  150. all : $(EXENAME)
  151. PASFILES:=$(shell ls *.pas)
  152. INCFILES:=$(shell ls *.inc)
  153. MSGFILES:=$(shell ls *.msg)
  154. info :
  155. @echo Target is $(TARGET)
  156. @echo basedir is $(BASEDIR)
  157. @echo Pascal files are $(PASFILES)
  158. @echo Inc files are $(INCFILES)
  159. @echo Msg files are $(MSGFILES)
  160. ifdef inlinux
  161. $(MAKEDEP) : $(RTLDIR)/utils/mkdep.pp
  162. $(PP) $(RTLDIR)/utils/mkdep.pp
  163. $(CP) $(RTLDIR)/utils/$(MAKEDEP) $(MAKEDEP)
  164. dependencies : $(MAKEDEP)
  165. $(MAKEDEP) pp.pas $(PPOPTS) > depend
  166. include depend
  167. endif
  168. ifdef inlinux
  169. $(EXENAME) : $(PPEXENAME)
  170. $(REPLACE) $(PPEXENAME) $(EXENAME)
  171. else
  172. $(EXENAME) : $(PASFILES) $(INCFILES) $(MSGFILES)
  173. $(COMPILER) pp.pas
  174. $(REPLACE) $(PPEXENAME) $(EXENAME)
  175. endif
  176. #
  177. # This target remakes the units with the currently made version
  178. #
  179. remake: $(EXENAME)
  180. $(REPLACE) $(EXENAME) $(TEMPNAME)
  181. $(MAKE) clean
  182. $(MAKE) -C $(UNITDIR) clean
  183. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME)' all
  184. $(MAKE) 'PP=./$(TEMPNAME)' all
  185. remake3: $(TEMPNAME3)
  186. $(MAKE) clean
  187. $(MAKE) -C $(UNITDIR) clean
  188. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME3)' all
  189. $(MAKE) 'PP=./$(TEMPNAME3)' all
  190. diff $(TEMPNAME3) $(EXENAME)
  191. $(TEMPNAME1) : $(EXENAME)
  192. $(REPLACE) $(EXENAME) $(TEMPNAME1)
  193. $(TEMPNAME2) : $(TEMPNAME1)
  194. $(MAKE) clean
  195. $(MAKE) -C $(UNITDIR) clean
  196. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME1)' all
  197. $(MAKE) 'PP=./$(TEMPNAME1)' all
  198. $(REPLACE) $(EXENAME) $(TEMPNAME2)
  199. $(TEMPNAME3) : $(TEMPNAME2)
  200. $(MAKE) clean
  201. $(MAKE) -C $(UNITDIR) clean
  202. $(MAKE) -C $(UNITDIR) 'PP=$(COMPILERDIR)/$(TEMPNAME2)' all
  203. $(MAKE) 'PP=./$(TEMPNAME2)' all
  204. $(REPLACE) $(EXENAME) $(TEMPNAME3)
  205. cycle:
  206. $(MAKE) clean
  207. $(MAKE) -C $(UNITDIR) clean
  208. $(MAKE) -C $(UNITDIR)
  209. $(MAKE) remake3
  210. install : all
  211. install -m 755 -d $(LIBINSTALLDIR)
  212. install -m 755 ppc386 $(LIBINSTALLDIR)
  213. ln -sf $(LIBINSTALLDIR)/ppc386 $(PROGINSTALLDIR)/ppc386
  214. makecfg $(LIBINSTALLDIR) $(GCCLIBPATH)
  215. install -m 644 ppc386.cfg /etc
  216. install -m 644 errorE.msg $(LIBINSTALLDIR)
  217. @echo Wrote sample configuration file to /etc
  218. clean :
  219. ifdef inlinux
  220. -rm -f *.o *.ppu *.s $(EXENAME) ppc386.cfg
  221. else
  222. -rm -f *.o *.ppu *.s $(EXENAME)
  223. endif
  224. dist :
  225. mkdir $(DISTDIR)/compiler
  226. cp *.pas *.inc makecfg Makefile depend errorE.msg $(DISTDIR)/compiler
  227. #
  228. # Utilities for making archives.
  229. #
  230. SOURCEFILES = $(PASFILES) $(INCFILES) $(MSGFILES) Makefile
  231. DIFFFILES = $(patsubst %.pas,%.dif,$(PASFILES)) \
  232. $(patsubst %.inc,%.dif,$(INCFILES)) \
  233. $(patsubst %.msg,%.dif,$(MSGFILES)) \
  234. Makefile.dif
  235. DIFF3FILES = $(patsubst %.pas,%.d3p,$(PASFILES)) \
  236. $(patsubst %.inc,%.d3i,$(INCFILES)) \
  237. $(patsubst %.msg,%.d3m,$(MSGFILES)) \
  238. Makefile.di3
  239. PATCHFILES = $(patsubst %.pas,%.new,$(PASFILES)) \
  240. $(patsubst %.inc,%.new,$(INCFILES)) \
  241. $(patsubst %.msg,%.new,$(MSGFILES)) \
  242. Makefile.new
  243. %.dif : %.pas
  244. -$(DIFF) $(DIFFOPTS) $*.pas $(DIFDIR)/$*.pas > $*.dif
  245. %.dif : %.msg
  246. -$(DIFF) $(DIFFOPTS) $*.msg $(DIFDIR)/$*.msg > $*.dif
  247. %.dif : %.inc
  248. -$(DIFF) $(DIFFOPTS) $*.inc $(DIFDIR)/$*.inc > $*.dif
  249. Makefile.dif : Makefile
  250. -$(DIFF) $(DIFFOPTS) Makefile $(DIFDIR)/Makefile > Makefile.dif
  251. %.new : %.pas %.dif
  252. -copy /y $*.pas $*.new
  253. -patch $*.new $*.dif
  254. %.new : %.msg %.dif
  255. -copy /y $*.msg $*.new
  256. -patch $*.new $*.dif
  257. %.new : %.inc %.dif
  258. -copy /y $*.inc $*.new
  259. -patch $*.new $*.dif
  260. Makefile.new : Makefile Makefile.dif
  261. -copy /y Makefile Makefile.new
  262. -patch Makefile.new Makefile.dif
  263. %.d3p : %.pas
  264. -$(DIFF3) -m -E $*.pas $(REFDIR)/$*.pas $(DIFDIR)/$*.pas > $*.d3p
  265. %.d3m : %.msg
  266. -$(DIFF3) -m -E $*.msg $(REFDIR)/$*.msg $(DIFDIR)/$*.msg > $*.d3m
  267. %.d3i : %.inc
  268. -diff3 -m -E $*.inc $(REFDIR)/$*.inc $(DIFDIR)/$*.inc > $*.d3i
  269. Makefile.di3: Makefile
  270. -diff3 -m -E Makefile $(REFDIR)/Makefile $(DIFDIR)/Makefile > Makefile.di3
  271. diff : $(DIFFFILES)
  272. diff3 : $(DIFF3FILES)
  273. replacediff3 : diff3
  274. copy /y *.pas *.bkp
  275. copy /y *.inc *.bki
  276. copy /y *.msg *.bkm
  277. copy /y Makefile Makefile.old
  278. copy /y *.d3p *.pas
  279. copy /y *.d3i *.inc
  280. copy /y *.d3m *.msg
  281. copy /y Makefile.di3 Makefile
  282. restorediff3 :
  283. copy /y *.bkp *.pas
  284. copy /y *.bki *.inc
  285. copy /y *.bkm *.msg
  286. copy /y Makefile.old Makefile
  287. patch : $(PATCHFILES)
  288. diffclean :
  289. -del *.dif
  290. -del *.di3
  291. -del *.new
  292. rtl :
  293. make -C $(UNITDIR) all
  294. rtlclean :
  295. make -C $(UNITDIR) clean
  296. ################################################
  297. ## Just an easy way to handle the diffs
  298. ## I just use the tiny program cpne.pp
  299. ## that copy to directory toflor all .dif files
  300. ## that are not empty
  301. ## empty files are deleted
  302. ## I did not find any direct way to do this !! (PM)
  303. #################################################
  304. #########################
  305. # When making zip files
  306. #########################
  307. # Zip program
  308. ifdef inlinux
  309. ZIP = zip
  310. else
  311. ZIP = c:/pak/zip/zip386
  312. endif
  313. # Unzip program
  314. ifdef inlinux
  315. UNZIP = unzp
  316. else
  317. UNZIP= c:/pak/zip/unzip
  318. endif
  319. DIF=v97
  320. toflor : diff
  321. -rm toflor/*.dif
  322. cpne *.dif toflor
  323. cp Makefile toflor/Makefile
  324. cp cpne.pp toflor/cpne.pp
  325. cd toflor
  326. zip dif2$(DIF) *.dif Makefile cpne.pp
  327. cd ..
  328. src_comp.zip : $(SOURCEFILES)
  329. $(ZIP) -u src_comp $(SOURCEFILES)
  330. #################################################
  331. # Obsolete
  332. # does not contains all directories
  333. #################################################
  334. rtlzip :
  335. echo rtl\Makefile >rtl.cfg
  336. echo rtl\readme >>rtl.cfg
  337. echo rtl\cfg\Makefile >>rtl.cfg
  338. echo rtl\cfg\readme >>rtl.cfg
  339. echo rtl\cfg\*.cfg >>rtl.cfg
  340. echo rtl\inc\Makefile >>rtl.cfg
  341. echo rtl\inc\readme >>rtl.cfg
  342. echo rtl\inc\*.pp >>rtl.cfg
  343. echo rtl\inc\*.inc >>rtl.cfg
  344. echo rtl\i386\Makefile >>rtl.cfg
  345. echo rtl\i386\readme >>rtl.cfg
  346. echo rtl\i386\*.pp >>rtl.cfg
  347. echo rtl\i386\*.inc >>rtl.cfg
  348. echo rtl\m68k\Makefile >>rtl.cfg
  349. echo rtl\m68k\readme >>rtl.cfg
  350. echo rtl\m68k\*.pp >>rtl.cfg
  351. echo rtl\m68k\*.inc >>rtl.cfg
  352. echo rtl\template\Makefile >>rtl.cfg
  353. echo rtl\template\readme >>rtl.cfg
  354. echo rtl\template\*.pp >>rtl.cfg
  355. echo rtl\template\*.pas >>rtl.cfg
  356. echo rtl\template\*.inc >>rtl.cfg
  357. echo rtl\dos\Makefile >>rtl.cfg
  358. echo rtl\dos\readme >>rtl.cfg
  359. echo rtl\dos\*.pp >>rtl.cfg
  360. echo rtl\dos\*.inc >>rtl.cfg
  361. echo rtl\dos\ppi\Makefile >>rtl.cfg
  362. echo rtl\dos\ppi\readme >>rtl.cfg
  363. echo rtl\dos\ppi\*.ppi >>rtl.cfg
  364. echo rtl\dos\go32v2\Makefile >>rtl.cfg
  365. echo rtl\dos\go32v2\readme >>rtl.cfg
  366. echo rtl\dos\go32v2\*.pp >>rtl.cfg
  367. echo rtl\dos\go32v2\*.inc >>rtl.cfg
  368. echo rtl\dos\go32v2\sbrk16.a* >>rtl.cfg
  369. echo rtl\dos\go32v2\exit16.a* >>rtl.cfg
  370. echo rtl\dos\go32v2\v2prt0.as >>rtl.cfg
  371. echo rtl\dos\go32v2\exceptn.as >>rtl.cfg
  372. echo rtl\dos\go32v1\Makefile >>rtl.cfg
  373. echo rtl\dos\go32v1\readme >>rtl.cfg
  374. echo rtl\dos\go32v1\*.pp >>rtl.cfg
  375. echo rtl\dos\go32v1\*.inc >>rtl.cfg
  376. echo rtl\dos\go32v1\prt0.as >>rtl.cfg
  377. echo rtl\linux\Makefile >>rtl.cfg
  378. echo rtl\linux\readme >>rtl.cfg
  379. echo rtl\linux\*.pp >>rtl.cfg
  380. echo rtl\linux\*.inc >>rtl.cfg
  381. echo rtl\linux\prt*.as >>rtl.cfg
  382. echo rtl\os2\Makefile >>rtl.cfg
  383. echo rtl\os2\readme >>rtl.cfg
  384. echo rtl\os2\*.pas >>rtl.cfg
  385. echo rtl\os2\*.inc >>rtl.cfg
  386. echo rtl\os2\*.imp >>rtl.cfg
  387. echo rtl\os2\*.a >>rtl.cfg
  388. echo rtl\os2\*.btm >>rtl.cfg
  389. echo rtl\os2\*.cmd >>rtl.cfg
  390. echo rtl\os2\prt*.as >>rtl.cfg
  391. echo rtl\os2\dosini*.as >>rtl.cfg
  392. echo rtl.cfg >>rtl.cfg
  393. echo rtl.txt >>rtl.cfg
  394. echo Makefile >>rtl.cfg
  395. cd ..
  396. $(ZIP) -u rtl @rtl.cfg
  397. $(UNZIP) -v rtl >rtl.lst
  398. cycle: clean