* mpw-make.sed: Update to handle shared library support.
[external/binutils.git] / binutils / mpw-make.sed
1 # Sed commands to finish translating the binutils Unix makefile into MPW syntax.
2
3 # Add a rule.
4 /^#### .*/a\
5 \
6 "{o}"underscore.c.o \\Option-f "{o}"underscore.c\
7
8 # Comment out any alias settings.
9 /^host_alias =/s/^/#/
10 /^target_alias =/s/^/#/
11
12 # Whack out unused host define bits.
13 /HDEFINES/s/@HDEFINES@//
14
15 /BUILD_NLMCONV/s/@BUILD_NLMCONV@//
16 /BUILD_SRCONV/s/@BUILD_SRCONV@//
17 /BUILD_DLLTOOL/s/@BUILD_DLLTOOL@//
18
19 /UNDERSCORE/s/@UNDERSCORE@/{UNDERSCORE}/
20
21 # Don't need this.
22 /@HLDFLAGS@/s/@HLDFLAGS@//
23
24 # Point at the libraries directly.
25 /@BFDLIB@/s/@BFDLIB@/::bfd:libbfd.o/
26 /@OPCODES@/s/@OPCODES@/::opcodes:libopcodes.o/
27
28 # Whack out target makefile fragment.
29 /target_makefile_fragment/s/target_makefile_fragment@//
30
31 # Fix and add to the include paths.
32 /^INCLUDES = .*$/s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/
33 /BFDDIR/s/-i {BFDDIR} /-i "{BFDDIR}": /
34 /INCDIR/s/-i {INCDIR} /-i "{INCDIR}": /
35
36 # Use byacc instead of bison (for now anyway).
37 /BISON/s/^BISON =.*$/BISON = byacc/
38 #/BISONFLAGS/s/^BISONFLAGS =.*$/BISONFLAGS = /
39
40 # '+' is a special char to MPW, don't use it ever.
41 /c++filt/s/c++filt/cplusfilt/
42
43 /^{[A-Z]*_PROG}/s/$/ "{s}"mac-binutils.r/
44 /{[A-Z]*_PROG}\.r/s/{[A-Z]*_PROG}\.r/mac-binutils.r/
45
46 # There are auto-generated references to BFD .h files that are not
47 # in the objdir (like bfd.h) but are in the source dir.
48 /::bfd:lib/s/::bfd:lib\([a-z]*\)\.h/{BFDDIR}:lib\1.h/g
49
50 # Fix the locations of generated files.
51 /config/s/"{s}"config\.h/"{o}"config.h/g
52 /config/s/^config\.h/"{o}"config\.h/
53 /underscore/s/"{s}"underscore\.c/"{o}"underscore.c/g
54 /underscore/s/^underscore\.c/"{o}"underscore\.c/
55
56 # Fix paths to generated source files.
57 /lex.yy.c/s/"{s}"lex\.yy\.c/"{o}"lex.yy.c/g
58 /lex.yy.c/s/^lex\.yy\.c/"{o}"lex.yy.c/
59 /arlex.c/s/"{s}"arlex\.c/"{o}"arlex.c/g
60 /arlex.c/s/^arlex\.c/"{o}"arlex.c/
61 /y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g
62 /y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/
63 /arparse.c/s/"{s}"arparse\.c/"{o}"arparse.c/g
64 /arparse.c/s/^arparse\.c/"{o}"arparse.c/
65 /y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g
66 /y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/
67 /arparse.h/s/"{s}"arparse\.h/"{o}"arparse.h/g
68 /arparse.h/s/^arparse\.h/"{o}"arparse.h/
69
70 /"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g
71
72 # The generated lexer may include an ifdef for older Mac compilers that
73 # needs to work with newer compilers also.
74 /lex.yy.c/s/Rename -y \([^ ]*\) \([^ ]*\)$/sed -e 's,ifdef macintosh,if defined(macintosh) || defined(__MWERKS__),' \1 > \2/
75
76 # Fix an over-eagerness.
77 /echo.*WARNING.*This file/s/'.*'/' '/
78
79 # Add a "stamps" target.
80 $a\
81 stamps \\Option-f stamp-under\
82
83 /^install \\Option-f /,/^$/c\
84 install \\Option-f  all install-only\
85 \
86 install-only \\Option-f\
87         If "`Exists "{prefix}"`" == ""\
88                 Echo "{prefix}" does not exist, cannot install anything\
89                 Exit 1\
90         End If\
91         If "`Exists "{bindir}"`" == ""\
92                 NewFolder "{bindir}"\
93         End If\
94         # Need to copy all the tools\
95         For prog in {PROGS}\
96                 Set progname `echo {prog} | sed -e 's/.new//'`\
97                 Duplicate -y :{prog} "{bindir}"{progname}\
98         End For\
99
100
101 /true/s/ ; @true$//
102
103 # dot files are trouble, remove them and their actions.
104 /^\.dep/,/^$/d
105
106 # Remove un-useful targets.
107 /^Makefile \\Option-f/,/^$/d
108 /^"{o}"config.h \\Option-f/,/^$/d
109 /^config.status \\Option-f/,/^$/d
110
111 # Don't try to make the demangler's man page, it's useless.
112 /^{DEMANGLER_PROG}\.1 \\Option-f/,/^$/d
113 # Don't depend on it either.
114 /{DEMANGLER_PROG}/s/ {DEMANGLER_PROG}\.1//
115