comparison buildsys/mk/pcc.mk @ 0:3e629dc19168

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:24:28 +0100
parents
children 08b0c420ddff
comparison
equal deleted inserted replaced
-1:000000000000 0:3e629dc19168
1 #//////////////////////////////////////////////////////////////////////////////
2 #
3 # Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>,
4 # Tassilo Philipp <tphilipp@potion-studios.com>
5 #
6 # Permission to use, copy, modify, and distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #
18 #//////////////////////////////////////////////////////////////////////////////
19
20
21 #@@@ add stuff for crosscompiling here.
22
23 CC = pcc
24 LD = pcc
25
26 #@@@.if $(BUILD_CONFIG) == "debug"
27 #@@@ add -g option or similar
28 #@@@.endif
29 CPPFLAGS = -D__Plan9__ -D__${objtype}__
30 CFLAGS = -D__Plan9__ -D__${objtype}__ -I$TOP/dyncall -I$TOP/dyncallback -c
31 #CXXFLAGS = $CXXFLAGS -D__Plan9__
32 #ASFLAGS = -D__Plan9__
33
34 # JUST TEMPORARY AS LONG AS I'M WORKING ON IT - Plan9's sed doesn't support sed comments
35 # /^$/d # Remove empty lines.
36 # /^#.*/d # Remove comments.
37 # s/^\.(globl|intel_syntax|file|section).*// # Remove some GAS directives.
38 # s/(.*):/TEXT \1(SB), $0/g # Reformat function names.
39 # s/%//g # Remove % register prefixes.
40 # /^[ ]+/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ # Convert everything to uppercase.
41 # s/([A-Z]+)[ ]*E(..)[, ]*E(..)/\1L \3, \2/ # Convert 32bit instructions with 2 register operands.
42 # s/([A-Z]+)[ ]*E(..)[, ]*([0-9]+)/\1L $\3, \2/ # Convert 32bit instructions with register and constant as
43 # s/([A-Z]+)[ ]*E(..)[, ]*\[E(..)\+([0-9]+)\]/\1L \4(\3), \2/ # Convert 32bit instructions with register and address as
44 # s/([A-Z]+)[ ]*E(..)[, ]*\[E(..)\]/\1L 0(\3), \2/ # Convert 32bit instructions with register and address as
45 # s/(CALL)[ ]*E(..)[ ]*$/\1 \2/ # Convert CALL instructions.
46 # s/(CALL)[ ]*\[E(..)\+([0-9]+)\]/\1 \3(\2)/ # Convert CALL instructions with addressing mode.
47 # s/([A-Z]+)[ ]*E(..)[ ]*$/\1L \2/ # Convert 32bit instructions with register operand.
48 # s/([A-Z]+)[ ]*\[E(..)\+([0-9]+)\]/\1L \3(\2)/ # Convert 32bit instructions with address operand.
49 # s/([A-Z]+)[ ]*\[E(..)\]/\1L 0(\2)/ # Convert 32bit instructions with address operand.
50 # s/(REP)[ ]*(MOV)SB[ ]*$/\1; \2B SI, DI/ # Convert repeater prefix stuff.
51 # s/(REP)[ ]*(MOV)SD[ ]*$/\1; \2L SI, DI/ # Convert repeater prefix stuff.
52
53 # Step to transform .S into object files.
54 %.$O: %.S
55 cp $prereq $prereq.c
56 pcc -E $CPPFLAGS $prereq.c > $stem.s # replace with cpp? pcc requires .c suffix
57 rm $prereq.c
58 $AS $AFLAGS $stem.s
59 rm $stem.s
60