make.rexx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. A simple make script for FPC Pascal.
  3. For your final release you can use this script
  4. to get the smallest possible program.
  5. If you are using the ms-dos cross compiler you
  6. can use this script to assemble and link your
  7. programs.
  8. This is what I started with, compiled all units
  9. on ms-dos and moved them over to my Amiga. There
  10. I assembled all to objectfiles. Now I could
  11. compile testprograms on ms-dos, move to Amiga
  12. and use this script to put it all together.
  13. Usage:
  14. rx make testprog.pas exec intuition graphics
  15. This will compile testprog.pas and link
  16. prt0.o, sysamiga.o, exec.o, intuition.o,
  17. graphics.o and testprog.o to testprog.
  18. rx make testprog.asm exec intuition graphics
  19. The same as above but it just assembles
  20. testprog.asm and links it.
  21. rx make testprog exec intuition graphics
  22. The same as above, treats testprog as an
  23. assembler file.
  24. Don't forget so set the correct paths for
  25. the binaries bellow.
  26. This is just a quick hack but it does work.
  27. [email protected]
  28. */
  29. SIGNAL ON BREAK_C
  30. SIGNAL ON SYNTAX
  31. parse arg main list
  32. /*
  33. First parse the args and set up a list
  34. */
  35. k = 0 œ
  36. do while list ~= ''
  37. parse var list keyword.k list
  38. k=k+1
  39. end
  40. /*
  41. Set the correct path
  42. */
  43. ASCOM = 'dh1:fpc/bin/as'
  44. LDCOM = 'dh1:fpc/bin/ld'
  45. UNITS = 'dh1:fpc/units/'
  46. SYSUNITS = 'dh1:fpc/lib/'
  47. PPCCOM = 'dh1:fpc/bin/ppc'
  48. STRIPCOM = 'dh1:fpc/bin/strip'
  49. /*
  50. Set the system units in the list
  51. */
  52. linkline = SYSUNITS || 'prt0.o ' || SYSUNITS || 'sysamiga.o '
  53. /*
  54. If there are more args, put in linklist
  55. */
  56. do n=0 to k-1
  57. linkline = linkline || UNITS || keyword.n || '.o'||' '
  58. end
  59. /*
  60. Check if it's a pascal or assembler file
  61. */
  62. parse var main head '.' ext
  63. if upper(ext) = 'PAS' | upper(ext) = 'P' | upper(ext) = 'PP' then do
  64. say 'Compiling ' || main
  65. address command PPCCOM || ' ' main || ' -Cn'
  66. if rc ~=0 then do
  67. say 'Problems with compiler'
  68. exit
  69. end
  70. end
  71. else do
  72. parse var main head '.' ext
  73. say 'Assembling ' || head
  74. address command ASCOM || ' ' || head || '.asm' || ' -o ' || head || '.o'
  75. if rc ~=0 then do
  76. say 'Problems with assembler'
  77. exit
  78. end
  79. end
  80. /*
  81. If we got here add to linklist
  82. */
  83. linkline = linkline || head || '.o' || ' -o ' || head
  84. /*
  85. Now link the files
  86. */
  87. say 'Linking ' || head
  88. address command LDCOM || ' ' || linkline
  89. if rc ~=0 then do
  90. say 'Problems with linker'
  91. exit
  92. end
  93. /*
  94. Use strip
  95. */
  96. say 'Using Strip on ' || head
  97. address command STRIPCOM || ' ' || head
  98. if rc ~=0 then do
  99. say 'Problems with strip'
  100. exit
  101. end
  102. say 'Done with ' || head
  103. exit
  104. BREAK_C:
  105. SYNTAX:
  106. SAY "Sorry, error line" SIGL ":" ErrorText(RC) ":-("
  107. EXIT