Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / gcc / cp / mpw-make.sed
1 # Sed commands to finish translating the G++ Unix makefile into MPW syntax.
2
3 # Remove control-Ls, they upset MPW make.
4 s/\f//g
5
6 # Remove references to always-empty variables used to mark things.
7 /CYGNUS-LOCAL-/s/{CYGNUS-LOCAL-[a-z0-9]*}//g
8
9 # Add a bunch of definitions, mostly empty.
10 /^# Variables that exist for you to override.$/a\
11 \
12 xmake_file = \
13 tmake_file = \
14 build_xm_file = \
15 MALLOC = \
16 MD_DEPS = \
17 REAL_H = \
18 HOST_CC_LD = {CC_LD}\
19 ALL_CCLDFLAGS = \
20 HOST_CCLDFLAGS = \
21 CONFIG_H = \
22 LIBDEPS = \
23
24 # The "target" variable is special to MPW make, avoid it.
25 /{target}/s/{target}/{target_canonical}/g
26
27 # Suppress the suppression of smart makes.
28 /^\.y\.c/d
29
30 # Whack out "..." assignments.
31 /\.\.\./s/^\([a-z_]*= \.\.\.\)/#\1/
32
33 # Previous edits go a little overboard, undo.
34 /^objext = /s/"{o}"//
35
36 # Always link in low-level MPW functions.
37 /^LIBDEPS=/s/$/ ::strerror.c.o ::mpwlib.c.o/
38 /{CLIB}/s/{CLIB}/ ::strerror.c.o ::mpwlib.c.o {CLIB}/
39
40 # Don't get tricky about finding various .o file, point at dir above.
41 /^SUBDIR_OBSTACK/s/`.*`/::obstack.c.o/
42 /^SUBDIR_USE_ALLOCA/s/`.*`/::alloca.c.o/
43 /^SUBDIR_MALLOC/s/`.*`//
44
45 # Point includes at parent directly correctly.
46 /^INCLUDES = /s/:\./::/g
47 /^INCLUDES = /s/"{srcdir}"\.\./"{topsrcdir}"gcc:/g
48 /^INCLUDES = /s,"{srcdir}"/\.\.,"{topsrcdir}"gcc:,g
49 /^INCLUDES = /s,"{srcdir}":config,"{topsrcdir}"gcc:config:,g
50
51 # Add the special MPW include dirs.
52 /^INCLUDES = /s/$/ -i "{topsrcdir}"include:mpw: -i :::extra-include:/
53
54 # A nasty hack to reduce confusion.
55 /true/s/ ; @true$//
56
57 # (should be in common translation?)
58 /{CC_LD} /s/$/ {EXTRALIBS}/
59
60 # Don't use general compiler flags (which may include definitions
61 # and other compiler-only bits) with linking commands.
62 /{CC_LD} /s/ALL_CFLAGS/ALL_CCLDFLAGS/
63
64 # Whack out build rules that are not useful.
65 /^Makefile \\Option-f /,/^$/d
66 /^config.status \\Option-f /,/^$/d
67 # (Note that MPW make is not case sensitive, and so this name
68 # is considered the same as "md_file".)
69 /^{MD_FILE} \\Option-f/,/^$/d
70
71 # Depending on config.status is not useful for us.
72 /config.status/s/ config.status//
73
74 # Repeat of stuff from generic edit.
75 /{s}/s/"{s}""{s}"/"{s}"/g
76 /{s}/s/"{s}""{srcdir}"/"{s}"/g
77 /{s}/s/"{srcdir}""{s}"/"{s}"/g
78
79 # Fix references to C frontend files in main dir.
80 /::c-/s/"{o}"::c-/"{o}":c-/g
81
82 # Fix pathnames to generated files in the objdir.
83 /parse/s/"{s}"parse\.\([chy]\)/"{o}"parse.\1/g
84 /parse/s/^parse\.\([chy]\)/"{o}"parse.\1/
85 /y.tab.c/s/"{s}"y\.tab\.c/"{o}"y.tab.c/g
86 /y.tab.c/s/^y\.tab\.c/"{o}"y.tab.c/
87 /y.tab.h/s/"{s}"y\.tab\.h/"{o}"y.tab.h/g
88 /y.tab.h/s/^y\.tab\.h/"{o}"y.tab.h/
89
90 # Put in the definition of YYEMPTY directly.
91 /grep/s/grep .* >>/Echo '#define YYEMPTY -1' >>/
92
93 # If the dates are wrong, then this tries to run gperf, which we don't
94 # really want.
95 /^"{srcdir}"hash.h/,/hash.h$/d
96
97 # Sed the object file list instead of using cat (meow).
98 /cat/s/`cat /`sed -e 's,:,::,g' -e 's,{objext},.o,g' /
99
100 # Simplify dependencies of generated parser files.
101 /^{PARSE_C}/s/^/#/
102 /^stamp-parse/s/^stamp-parse/{PARSE_C}/
103
104 # Fix the compile line for the generated parser.
105 /{CC} -c/,/echo {PARSE_C}/c\
106         {CC} @DASH_C_FLAG@ {ALL_CFLAGS} {ALL_CPPFLAGS} {INCLUDES} {BIG_SWITCHFLAG} "{o}"parse.c -o "{o}"parse.c.o\
107
108 # Change all Rez commands to use mac-gcc.r.
109 /{REZ}/s/"{s}"[-a-zA-Z{}]*\.r/"{topsrcdir}"gcc:mac-gcc.r/
110
111 # Remove pathname junk from the container name.
112 /{REZ}/s/'"'::cc1plus'"'/'"'cc1plus'"'/