1 | # Rewrite default rules from .c.o: to .c.o: .c |
---|
2 | /^\./s/^\(\.[a-z]*\)\(\.[a-z]*\)\( *: *\)$/\1\2\3 \1/ |
---|
3 | |
---|
4 | # Change dependency char. |
---|
5 | /::/s/::/ \\Option-f\\Option-f /g |
---|
6 | /:/s/:/ \\Option-f /g |
---|
7 | /^[SU]=/s/ \\Option-f /:/g |
---|
8 | |
---|
9 | # Change syntax of Makefile vars. |
---|
10 | /\$/s/\${\([a-zA-Z0-9_]*\)}/{\1}/g |
---|
11 | /\$/s/\$(\([a-zA-Z0-9_]*\))/{\1}/g |
---|
12 | |
---|
13 | # Change $@ to {targ} |
---|
14 | /\$@/s/\$@/{targ}/g |
---|
15 | |
---|
16 | # Change pathname syntax. |
---|
17 | # |
---|
18 | # If line ends with .. then assume it sets a variable that will |
---|
19 | # be used to prefix something else -- eliminate one colon, assuming |
---|
20 | # that a slash after the ${name} will turn into the missing colon. |
---|
21 | # Mac pathname conventions are IRREGULAR and UGLY! |
---|
22 | /\./s,\.\./\.\.$,::, |
---|
23 | /\./s,\.\.$,:, |
---|
24 | # Same if it ends with . (a single dot); turn it into nothing. |
---|
25 | /\./s,\.$,,g |
---|
26 | # Rules for .. and . elsewhere in the line |
---|
27 | # Convert ../: to ::, recur to get whole paths. |
---|
28 | /\./s,\.\./:,::,g |
---|
29 | # Convert ../../ to ::: |
---|
30 | /\./s,\.\./\.\./,:::,g |
---|
31 | /\./s,\.\./,::,g |
---|
32 | /\.\//s,\./,:,g |
---|
33 | /\//s,/,:,g |
---|
34 | |
---|
35 | /=/s/ = \.$/ = :/ |
---|
36 | |
---|
37 | # Comment out any explicit srcdir setting. |
---|
38 | # /srcdir/s/^srcdir/# srcdir/ |
---|
39 | |
---|
40 | /version/s/^version=/# version=/ |
---|
41 | |
---|
42 | /BASEDIR/s/^BASEDIR =.*$/BASEDIR = "{srcroot}"/ |
---|
43 | /{BASEDIR}:/s/{BASEDIR}:/{BASEDIR}/g |
---|
44 | # The original lines screw up -I$(srcdir)/../des by eliminating a colon. |
---|
45 | # Proposed fix: Eliminate srcdir prefixes totally. |
---|
46 | #/{srcdir}:/s/{srcdir}:/"{srcdir}"/g |
---|
47 | /{srcdir}:/s/{srcdir}://g |
---|
48 | #/"{srcdir}":/s/"{srcdir}":/"{srcdir}"/g |
---|
49 | |
---|
50 | # Comment out settings of anything set by mpw host config. |
---|
51 | ##/CC/s/^CC *=/#CC =/ |
---|
52 | ##/CFLAGS/s/^CFLAGS *=/#CFLAGS =/ |
---|
53 | ##/LDFLAGS/s/^LDFLAGS *=/#LDFLAGS =/ |
---|
54 | |
---|
55 | # Change -I usage. |
---|
56 | /-I/s/-I\./-i :/g |
---|
57 | /-I/s/-I::bfd/-i ::bfd:/g |
---|
58 | /-I/s/-I::include/-i ::include:/g |
---|
59 | /-I/s/-I/-i /g |
---|
60 | |
---|
61 | # Change -D usage. |
---|
62 | /-D/s/\([ =]\)-D\([^ ]*\)/\1-d \2/g |
---|
63 | |
---|
64 | # Change continuation char. |
---|
65 | /\\$/s/\\$/\\Option-d/ |
---|
66 | |
---|
67 | # Change wildcard char. |
---|
68 | /^[^#]/s/\*/\\Option-x/g |
---|
69 | |
---|
70 | # Change path of various types of source files. |
---|
71 | #/\.[chly]/s/\([ ><=]\)\([-a-zA-Z0-9_$:"]*\)\.\([chly]\)/\1"{s}"\2.\3/g |
---|
72 | #/\.[chly]/s/^\([-a-zA-Z0-9_${}:"]*\)\.\([chly]\)/"{s}"\1.\2/g |
---|
73 | # Skip the {s} and {o} business for now... |
---|
74 | # Fix some overenthusiasms. |
---|
75 | #/{s}/s/"{s}""{srcdir}"/"{srcdir}"/g |
---|
76 | #/{s}/s/"{s}"{\([a-zA-Z0-9_]*\)dir}/"{\1dir}"/g |
---|
77 | #/{s}/s/"{s}"{\([a-zA-Z0-9_]*\)DIR}/"{\1DIR}"/g |
---|
78 | #/{s}/s/"{s}""{\([a-zA-Z0-9_]*\)dir}"/"{\1dir}"/g |
---|
79 | #/{s}/s/"{s}""{\([a-zA-Z0-9_]*\)DIR}"/"{\1DIR}"/g |
---|
80 | #/{s}/s/"{s}":/:/g |
---|
81 | #/{s}/s/^"{s}"//g |
---|
82 | #/^\./s/"{s}"\././g |
---|
83 | |
---|
84 | # Change extension and path of objects, except in the OBJEXT line. |
---|
85 | #/^OBJEXT/!s/\([ =]\)\([-a-zA-Z0-9_${}:"]*\)\.o/\1"{o}"\2.c.o/g |
---|
86 | #/\.o/s/^\([-a-zA-Z0-9_${}:"]*\)\.o/"{o}"\1.c.o/g |
---|
87 | # Skip the {o} stuff for now... |
---|
88 | /^OBJEXT/!s/\([ =]\)\([-a-zA-Z0-9_${}:"]*\)\.o/\1\2.c.o/g |
---|
89 | /\.o/s/^\([-a-zA-Z0-9_${}:"]*\)\.o/\1.c.o/g |
---|
90 | # Clean up. |
---|
91 | #/\.o/s/"{o}""{o}"/"{o}"/g |
---|
92 | #/{o}/s/^"{o}"\([a-zA-Z0-9_]*\)=/\1=/g |
---|
93 | |
---|
94 | # Change extension of libs. |
---|
95 | # /\.a/s/lib\([a-z]*\)\.a/lib\1.o/g |
---|
96 | |
---|
97 | # Remove non-echo option. |
---|
98 | /^ -/s/^ -/ / |
---|
99 | |
---|
100 | # Change cp to duplicate. |
---|
101 | # /cp/s/^\([ ]*\)cp /\1Duplicate -d -y / |
---|
102 | # Change mv to rename. |
---|
103 | # /mv/s/^\([ ]*\)mv /\1Rename -y / |
---|
104 | # /Rename/s/^\([ ]*\)Rename -y -f/\1Rename -y/ |
---|
105 | # Change rm to delete. |
---|
106 | /^RM=/s/rm -f/Delete -i -y/ |
---|
107 | # /rm/s/^\([ ]*\)rm /\1Delete -y / |
---|
108 | # /Delete/s/^\([ ]*\)Delete -y -f/\1Delete -y/ |
---|
109 | # Comment out symlinking. |
---|
110 | # /ln/s/^\([ ]*\)ln /\1# ln / |
---|
111 | |
---|
112 | # Remove -c from explicit compiler calls. |
---|
113 | # /-c/s/{CC}\(.*\) -c \(.*\)\([-a-z]*\)\.c/{CC}\1 \2\3.c -o "{o}"\3.c.o/g |
---|
114 | # Don't ask... prev subst seems to omit the second filename. |
---|
115 | # /-o/s/\([-a-z]*\)\.c -o "{o}".c.o/\1\.c -o "{o}"\1.c.o/ |
---|
116 | |
---|
117 | # Change linking cc to link. |
---|
118 | /LDFLAGS/ s/{CC} \(.*\){CFLAGS}\(.*\){LDFLAGS}/Link \1 \2 {LDFLAGS}/ |
---|
119 | /CFLAGS_LINK/s/{CC} \(.*\){CFLAGS_LINK}\(.*\){LDFLAGS}/Link \1 \2 {LDFLAGS}/ |
---|
120 | |
---|
121 | # Comment out .PHONY rules. |
---|
122 | /\.PHONY/s/^\.PHONY/# \.PHONY/ |
---|
123 | # Comment out .SUFFIXES rules. |
---|
124 | /\.SUFFIXES/s/^\.SUFFIXES/# \.SUFFIXES/ |
---|
125 | # Comment out .PRECIOUS rules. |
---|
126 | /\.PRECIOUS/s/^\.PRECIOUS/# \.PRECIOUS/ |
---|
127 | ## Comment out default rules. |
---|
128 | ##/^\./s/^\(\.[a-z]*\.[a-z]* \)/# \1/ |
---|
129 | |
---|
130 | # |
---|
131 | # End of original hack-mf.sed |
---|
132 | # |
---|
133 | # Begin original hack-mf2.sed |
---|
134 | # |
---|
135 | # Transform expressions. |
---|
136 | |
---|
137 | # Set the install program appropriate. |
---|
138 | # /INSTALL/s/^INSTALL *= *`.*`:install.sh -c/INSTALL = Duplicate -y/ |
---|
139 | |
---|
140 | # Include from the extra-include dir. |
---|
141 | # /^INCLUDES = /s/^INCLUDES = /INCLUDES = -i "{srcroot}"extra-include / |
---|
142 | |
---|
143 | # Yuck - remove unconverted autoconf things. |
---|
144 | # /@/s/@[^ ]*@//g |
---|
145 | |
---|
146 | # Hackery, pure and simple |
---|
147 | # To speed up compiles, remove duplicated -i options. |
---|
148 | /-i/s/\(-i [^ ]*\) \1 /\1 /g |
---|
149 | |
---|
150 | # Note! There are 8-bit characters in the three lines below: |
---|
151 | # 0xc4, 0xb6, 0xc5. |
---|
152 | /Option/s/\\Option-f/Ä/g |
---|
153 | /Option/s/\\Option-d/¶/g |
---|
154 | /Option/s/\\Option-x/Å/g |
---|