1 # ACD pass description for the ACK compilers.
4 # PROGRAM - Name the compiler driver is called with.
5 # ARCH - Default target architecture.
7 # Library directories search path.
10 # ACK Compilers support search path.
13 # ARCH must be defined.
15 error "\$ARCH is not predefined"
17 # Get ARCH from the environment if set.
21 ACK_CPP = $A/cpp.ansi $CPP_F $PREDEF $NOLINENO
22 ACK_CEM = $A/em_cemcom.ansi -L $CPP_F $PREDEF \
23 -Vw${W}.${W}i${W}.${W}p${P}.${W}f4.${W}s2.2l4.${W}d8.${W}
24 ACK_M2 = $A/em_m2 -I$MOD_INCL -WR \
25 -Vw${W}.${W}i${W}.${W}p${P}.${W}l4.${W}f4.${W}d8.${W}
27 -Vw${W}.${W}i${W}.${W}l4.${W}p${P}.${W}f8.${W}S${W}.${W}
29 ACK_DECODE = $A/em_decode
30 ACK_ENCODE = $A/em_encode
32 ACK_EGO = $A/em_ego -P $A/ego -M$EGO_DESCR
33 EGO_DESCR = $A/ego/${ARCH}descr +
36 ACK_AS = $A/$ARCH/as \-
37 ACK_LED = $A/em_led -a0:$W -a1:$W -a2:$W -a3:$W
39 ASMCONV = /usr/bin/asmconv
42 # Minix predefined symbols.
43 CPP_F = -D__minix -D__minix3 -D__$ARCH
46 LIBPATH = $USERLIBPATH $A/$ARCH
48 # Default output "model".
51 # Floating point is done in software.
54 # Default optimization level.
67 # Default transformation target.
70 # Select the runtime environment by option or program name.
89 # Omit the runtime startoff, but keep the libraries.
94 error ".$any: unknown language"
96 # Select the target architecture.
100 # Preprocessor directives.
103 CPP_F = $CPP_F -D$name
106 CPP_F = $CPP_F -U$name
109 CPP_F = $CPP_F -I$dir
110 ACK_M2 = $ACK_M2 -I$dir
113 arg -g # Add debugging info.
114 ACK_CEM = $ACK_CEM -g
115 ACK_CG = $ACK_CG -gdb
117 arg -n # Suppress line numbers.
120 arg -a # Enable assertions.
121 arg -A # Enable array bound checks.
126 arg -w # No warnings.
127 ACK_CEM = $ACK_CEM $*
131 arg -ws # No strict warnings.
132 ACK_CEM = $ACK_CEM -s
135 arg -wa # No warnings and no strict warnings.
136 ACK_CEM = $ACK_CEM -a
139 arg -wo # No warnings about old style C.
140 ACK_CPP = $ACK_CPP -o
141 ACK_CEM = $ACK_CEM -o
144 arg -3 # Only accept 3rd generation Modula-2.
147 arg -_ # Allow underscores in identifiers.
154 # Ignore strange -w flags, and past and present i86 compiler flags.
177 arg -OS # Optimize for size.
178 ACK_EGO = $ACK_EGO -S
179 arg -OT # Optimize for time.
180 ACK_EGO = $ACK_EGO -T
186 # Library search path.
189 USERLIBPATH = $USERLIBPATH $dir/$ARCH $dir
191 # -llib must be searched in $LIBPATH later.
194 $> = $LIBPATH/lib$lib.a
196 # Software floating point, hardware floating point, or no floating point.
200 LIBS = $LIBS + -fsoft
203 LIBS = $LIBS - -fsoft
206 LIBS = $LIBS + -fnone
210 MODEL = # Common I&D.
213 arg -i # Separate I&D.
216 arg -r # Relocatable object (combined .o)
221 ACK_LED = $ACK_LED -s
223 # Size of heap+stack.
225 ACK_CV = $ACK_CV -S $size
227 # Change output file.
232 # Complain about just -D, -U, -I, ...
233 arg -D; arg -U; arg -I; arg -L; arg -l; arg -o; arg -stack
234 error "argument expected after '$*'"
236 arg -R$pass-$flag # The ACK way of passing options to passes.
237 arg -Wack-R$pass-$flag # The ACD way.
239 ACK_CPP = $ACK_CPP -$flag
241 ACK_CEM = $ACK_CEM -$flag
243 ACK_M2 = $ACK_M2 -$flag
245 ACK_PC = $ACK_PC -$flag
247 ACK_OPT = $ACK_OPT -$flag
249 ACK_EGO = $ACK_EGO -$flag
251 ACK_OPT2 = $ACK_OPT2 -$flag
253 ACK_CG = $ACK_CG -$flag
255 ACK_AS = $ACK_AS -$flag
257 ACK_LED = $ACK_LED -$flag
259 arg -Was-$dialect # Default assembly dialect.
263 # Ignore any other -W options.
265 # Complain about unknown options, don't give them to the loader.
267 error "$*: unknown option"
269 # Do the scanning phase early, we need to know the architecture.
272 # The word and pointer sizes of the target.
279 error "$ARCH: unsupported architecture"
281 # Optimize -O2 or higher?
282 if (0 1 - $OPT_LEVEL) = (0 1)
283 ACK_EGO = $ACK_EGO -O$OPT_LEVEL
284 ACK_OPT = $ACK_OPT -m0 # Leave multiplication optimization to opt2.
287 # Tell cem to reverse bitfields on the i386 to be compatible with gcc.
289 ACK_CEM = $ACK_CEM -Vr
291 # Predefined preprocessor flags.
292 PREDEF = -D_EM_WSIZE=$W -D_EM_PSIZE=$P -D_EM_SSIZE=2 -D_EM_LSIZE=4 \
293 -D_EM_FSIZE=4 -D_EM_DSIZE=8 -D__ACK__ -D_ACK
295 # Preprocess C source.
299 # Preprocess any type of file and send it to standard output or $OUT.
302 file = # Standard input.
308 $ACK_CPP $file > $OUT
310 # Compile C source to EM-code.
318 # Compile Modula-2 source to EM-code.
327 # Compile Pascal source to EM-code.
336 # Compact EM to readable EM.
343 # Readable EM to compact EM.
346 NOLINENO = -P # Encode chokes on cpp line directives.
351 # Peephole optimization.
355 # Global optimization.
359 # Second peephole optimization after global optimization.
363 # EM-code to target machine assembly.
369 $ACK_CG -F__fp_hook $* > $>
373 # How to treat plain .s?
378 # Assembly to object file.
387 # Combine object files and libraries to an executable.
395 rtso = $A/$ARCH/crtso.o
397 rtso = $A/$ARCH/m2rtso.o
399 rtso = $A/$ARCH/prtso.o
400 libm2 = ; libp = ; libd = ; libc = ; libfp =
401 if (-.mod - $LIBS) = ()
402 libm2 = $A/$ARCH/libm2.a
403 libc = $A/$ARCH/libc.a
404 if (-.p - $LIBS) = ()
405 libp = $A/$ARCH/libp.a
406 libc = $A/$ARCH/libc.a
407 if (-.c - $LIBS) = ()
408 libd = $A/$ARCH/libd.a
409 libc = $A/$ARCH/libc.a
410 if (-fsoft - $LIBS) = ()
411 libfp = $A/$ARCH/libfp.a
412 libs = $libm2 $libp $libd $libc $libfp $A/$ARCH/libe.a
415 if (-r - $MODEL) = ()
416 # Combine to an object file.
417 $ACK_LED -r -o $OUT $*
419 # Combine to an executable.
421 $ACK_LED $model -o $EXE $rtso $* $libs $A/$ARCH/end.a
422 $ACK_CV -x -m$ARCH $EXE $OUT
424 # Add object files to a library.
431 # Assembly conversions.
433 # ACK assembly to ACK Xenix assembly.
434 transform .ack.s .ncc.s
437 $ASMCONV -m$ARCH ack ncc $* $>
439 # ACK assembly to GNU assembly.
440 transform .ack.s .gnu.s
443 $ASMCONV -m$ARCH ack gnu $* $>
445 # ACK Xenix assembly to ACK assembly.
446 transform .ncc.s .ack.s
449 $ASMCONV -m$ARCH ncc ack $* $>
451 # ACK Xenix assembly to GNU assembly.
452 transform .ncc.s .gnu.s
455 $ASMCONV -m$ARCH ncc gnu $* $>
457 # BCC assembly to ACK assembly.
458 transform .bas.s .ack.s
461 $ASMCONV -m$ARCH bas ack $* $>
463 # BCC assembly to ACK Xenix assembly.
464 transform .bas.s .ncc.s
467 $ASMCONV -m$ARCH bas ncc $* $>
469 # BCC assembly to GNU assembly.
470 transform .bas.s .gnu.s
473 $ASMCONV -m$ARCH bas gnu $* $>
476 # Treat plain .s as being in the given dialect.
477 transform .s .$ASDIALECT.s