summaryrefslogtreecommitdiff
path: root/packages/amunits/scripts/make.rexx
blob: d7490ae79cd7d71889e0e3c63fd5a5566b29d710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*

  A simple make script for FPC Pascal.

  For your final release you can use this script
  to get the smallest possible program.

  If you are using the ms-dos cross compiler you
  can use this script to assemble and link your
  programs.
  This is what I started with, compiled all units
  on ms-dos and moved them over to my Amiga. There
  I assembled all to objectfiles. Now I could
  compile testprograms on ms-dos, move to Amiga
  and use this script to put it all together.

  Usage:

  rx make testprog.pas exec intuition graphics

  This will compile testprog.pas and link
  prt0.o, sysamiga.o, exec.o, intuition.o,
  graphics.o and testprog.o to testprog.

  rx make testprog.asm exec intuition graphics

  The same as above but it just assembles
  testprog.asm and links it.

  rx make testprog exec intuition graphics

  The same as above, treats testprog as an
  assembler file.


  Don't forget so set the correct paths for
  the binaries bellow.

  This is just a quick hack but it does work.

  nils.sjoholm@mailbox.swipnet.se

*/

SIGNAL ON BREAK_C
SIGNAL ON SYNTAX


parse arg main list

/*
  First parse the args and set up a list
*/

k = 0           œ
do while list ~= ''
parse var list keyword.k list
k=k+1
end

/*
  Set the correct path
*/

ASCOM    = 'dh1:fpc/bin/as'
LDCOM    = 'dh1:fpc/bin/ld'
UNITS    = 'dh1:fpc/units/'
SYSUNITS = 'dh1:fpc/lib/'
PPCCOM   = 'dh1:fpc/bin/ppc'
STRIPCOM = 'dh1:fpc/bin/strip'

/*
  Set the system units in the list
*/

linkline = SYSUNITS || 'prt0.o ' || SYSUNITS || 'sysamiga.o '

/*
  If there are more args, put in linklist
*/

do n=0 to k-1
linkline = linkline || UNITS || keyword.n || '.o'||' '
end

/*
  Check if it's  a pascal or assembler file
*/

parse var main head '.' ext
if upper(ext) = 'PAS' | upper(ext) = 'P' | upper(ext) = 'PP'  then do
   say 'Compiling ' || main
   address command PPCCOM || ' ' main || ' -Cn'
   if rc ~=0 then do
     say 'Problems with compiler'
     exit
   end
end
else do
   parse var main head '.' ext
   say 'Assembling ' || head
   address command ASCOM || ' ' || head || '.asm' || ' -o ' || head || '.o'
   if rc ~=0 then do
     say 'Problems with assembler'
   exit
   end
end

/*
  If we got here add to linklist
*/

linkline = linkline || head || '.o' || ' -o ' || head

/*
  Now link the files
*/

say 'Linking ' || head
address command LDCOM || ' ' || linkline
if rc ~=0 then do
  say 'Problems with linker'
  exit
  end

/*
  Use strip
*/

say 'Using Strip on ' || head
address command STRIPCOM || ' ' || head
if rc ~=0 then do
  say 'Problems with strip'
  exit
  end

say 'Done with ' || head
exit

BREAK_C:
SYNTAX:
SAY "Sorry, error line" SIGL ":" ErrorText(RC) ":-("
EXIT