From a3acbf46947e52ff596461a4cf6f539884c9dbbd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 3 May 1999 07:29:06 +0000 Subject: 19990502 sourceware import --- config/mpw/ChangeLog | 53 ++++++++ config/mpw/MoveIfChange | 19 +++ config/mpw/README | 23 ++++ config/mpw/forward-include | 3 + config/mpw/g-mpw-make.sed | 293 +++++++++++++++++++++++++++++++++++++++++++++ config/mpw/mpw-touch | 7 ++ config/mpw/mpw-true | 1 + config/mpw/null-command | 1 + config/mpw/open-brace | 4 + config/mpw/tr-7to8-src | 9 ++ config/mpw/true | 1 + 11 files changed, 414 insertions(+) create mode 100644 config/mpw/ChangeLog create mode 100644 config/mpw/MoveIfChange create mode 100644 config/mpw/README create mode 100644 config/mpw/forward-include create mode 100644 config/mpw/g-mpw-make.sed create mode 100644 config/mpw/mpw-touch create mode 100644 config/mpw/mpw-true create mode 100644 config/mpw/null-command create mode 100644 config/mpw/open-brace create mode 100644 config/mpw/tr-7to8-src create mode 100644 config/mpw/true (limited to 'config/mpw') diff --git a/config/mpw/ChangeLog b/config/mpw/ChangeLog new file mode 100644 index 000000000..3cdefbf7a --- /dev/null +++ b/config/mpw/ChangeLog @@ -0,0 +1,53 @@ +Tue Nov 26 12:34:12 1996 Stan Shebs + + * g-mpw-make.sed: Fix some comments. + +Mon Sep 16 14:42:52 1996 Stan Shebs + + * g-mpw-make.sed (HLDENV): Edit out all references. + +Thu Aug 15 19:49:23 1996 Stan Shebs + + * true: New script, identical to mpw-true. + * g-mpw-make.sed: Add @DASH_C_FLAG@ and @SEGMENT_FLAG()@ + to the editors for compile commands. + +Thu Aug 1 15:01:42 1996 Stan Shebs + + * mpw-true, mpw-touch, null-command: New scripts. + * README: Describe usage in more detail. + +Tue Dec 12 14:51:51 1995 Stan Shebs + + * g-mpw-make.sed: Don't edit out "version=" occurrences. + +Fri Dec 1 11:46:18 1995 Stan Shebs + + * g-mpw-make.sed (bindir, libdir): Edit the positions of + pathname separators to work with other pathnames better. + +Tue Nov 7 15:08:07 1995 Stan Shebs + + * g-mpw-make.sed: Add comment about Duplicate vs Catenate, + add additional pattern for editing link-compile commands. + +Tue Oct 24 14:28:51 1995 Stan Shebs + + * g-mpw-make.sed: Add handling for *.tab.[hc] files. + (CHILL_FOR_TARGET, CHILL_LIB): Edit out tricky definitions + of these. + +Thu Sep 28 21:05:10 1995 Stan Shebs + + * g-mpw-make.sed: New file, generic sed commands to translate + Unix makefiles into MPW makefile syntax. + +Fri Mar 17 11:51:20 1995 Stan Shebs + + * README: Clarify instructions. + * fi: Remove. + +Wed Dec 21 15:45:53 1994 Stan Shebs + + * MoveIfChange, README, fi, forward-include, open-brace, + tr-7to8-src: New files. diff --git a/config/mpw/MoveIfChange b/config/mpw/MoveIfChange new file mode 100644 index 000000000..0dbc12582 --- /dev/null +++ b/config/mpw/MoveIfChange @@ -0,0 +1,19 @@ +# Rename a file only if it is different from a previously existing +# file of the same name. This is useful for keeping make from doing +# too much work if the contents of a file haven't changed. + +# This is an MPW translation of the standard GNU sh script move-if-change. + +Set exit 0 + +If "`exists -f "{2}"`" + Compare "{1}" "{2}" >dev:null + If {status} != 0 + Rename -y "{1}" "{2}" + Else + Echo "{2}" is unchanged + Delete -i -y "{1}" + End +Else + Rename -y "{1}" "{2}" +End diff --git a/config/mpw/README b/config/mpw/README new file mode 100644 index 000000000..554700adc --- /dev/null +++ b/config/mpw/README @@ -0,0 +1,23 @@ +This directory contains MPW scripts and related files that are needed to +build Cygnus GNU tools for MPW. The scripts should be somewhere on the +command path; our usual practice has been to have a separate directory +for the scripts, and put the tools (byacc, flex, and sed at least) there +also; then it's easier to drag the support bits around as a group, or to +upgrade MPW versions. The complete package of scripts and tool binaries +is usually available as pub/mac/buildtools.cpt.hqx on ftp.cygnus.com. + +"tr-7to8-src" is actually the source to an MPW script that transforms +sequences like "\Option-d" into the actual 8-bit chars that MPW needs. +It's only the source because it can't itself include any 8-bit chars. +It *can* be processed into a genuine "tr-7to8" by using itself: + + tr-7to8 tr-7to8-src | sed -e 's/Src//' >new-tr-7to8 + +Use this to verify: + + compare tr-7to8 new-tr-7to8 + +If you don't have a working tr-7to8, then you will have to manually +replace all occurrences of "\Option-d" with real Option-d (which looks +like a delta), then do similarly with all the other "\Option-..." +strings, and then change "\SrcOption-d" into the string "\Option-d". diff --git a/config/mpw/forward-include b/config/mpw/forward-include new file mode 100644 index 000000000..ddd6bd711 --- /dev/null +++ b/config/mpw/forward-include @@ -0,0 +1,3 @@ +Echo '#include' ¶""{1}"¶" >"{2}".tem +MoveIfChange "{2}".tem "{2}" + diff --git a/config/mpw/g-mpw-make.sed b/config/mpw/g-mpw-make.sed new file mode 100644 index 000000000..e7d3c7707 --- /dev/null +++ b/config/mpw/g-mpw-make.sed @@ -0,0 +1,293 @@ +# Sed commands to translate Unix makefiles into MPW makefiles. +# These are nominally generic, but work best on the makefiles used +# for GNU programs. + +# Whack out any commented-out lines that are probably commands; +# they can only cause trouble later on. +/^# /d + +# Change dependency char. +/:$/s/:/ \\Option-f/g +/^[^ :#][^:]*:/s/\([ ]*\):\([ ]*\)/ \\Option-f /g + +# Change syntax of Makefile vars. +/\$/s/\${\([a-zA-Z0-9_-]*\)}/{\1}/g +/\$/s/\$(\([a-zA-Z0-9_-]*\))/{\1}/g +/ $@/s/ $@/ {Targ}/ + +# Double-$ are literals to Unix but not to MPW make. +/\$\$/s/\$\$/$/g + +# Change pathname syntax. +/\//s,\.\./\/\.\./,:::,g +/\//s,\.\./,::,g +/\.\//s,\./,:,g +/\//s,/,:,g +# Undo excess changes. +/and/s,and:or$,and/or, +/and/s,and:or ,and/or , +/want/s,want:need,want/need, +# Fixing up sed commands. +/-e/s_":\([^:]*\):d"_"/\1/d"_g +/-e/s_":\([^:]*\):,:\([^:]*\):d"_"/\1/,/\2/d"_g + +/=/s/ = \.$/ = :/ + +# Make these go away so that later edits not confused. +/HLDENV/s/{HLDENV}// + +# Comment out any explicit srcdir setting. +/srcdir/s/^srcdir/# srcdir/ + +/BASEDIR/s/^BASEDIR =.*$/BASEDIR = "{srcroot}"/ +/{BASEDIR}:/s/{BASEDIR}:/{BASEDIR}/g +/{srcdir}:/s/{srcdir}:/"{srcdir}"/g +/"{srcdir}":/s/"{srcdir}":/"{srcdir}"/g + +# Tweak some conventions that are backwards for the Mac. +/bindir/s/{exec_prefix}:bin/{exec_prefix}bin:/ +/libdir/s/{exec_prefix}:lib/{exec_prefix}lib:/ + +# Comment out settings of anything set by mpw host config. +/CC/s/^CC *=/#CC =/ +/CFLAGS/s/^CFLAGS *=/#CFLAGS =/ +/AR/s/^AR *=/#AR =/ +/AR_FLAGS/s/^AR_FLAGS *=/#AR_FLAGS =/ +/RANLIB/s/^RANLIB *=/#RANLIB =/ +/CC_LD/s/^CC_LD *=/#CC_LD =/ +/LDFLAGS/s/^LDFLAGS *=/#LDFLAGS =/ + +# Change -I usages. +/-I/s/-I\./-i :/g +/-I/s/-I::bfd/-i ::bfd:/g +/-I/s/-I::include/-i ::include:/g +/-I/s/-I/-i /g + +# Change -D usage. +/-D/s/\([ =]\)-D\([^ ]*\)/\1-d \2/g + +# Change continuation char. +/\\$/s/\\$/\\Option-d/ + +# Change wildcard char. +/\*/s/\*/\\Option-x/g + +# Change path of various types of source files. This rule does not allow +# for file names with multiple dots in the name. +/\.[chly]/s/\([ ><=]\)\([-a-zA-Z0-9_${}:"]*\)\.\([chly]\)/\1"{s}"\2.\3/g +/\.[chly]/s/^\([-a-zA-Z0-9_${}:"]*\)\.\([chly]\)/"{s}"\1.\2/ +# Allow files named *.tab.[ch] as a special case. +/\.tab\.[ch]/s/\([ ><=]\)\([-a-zA-Z0-9_${}:"]*\.tab\)\.\([ch]\)/\1"{s}"\2.\3/g +/\.tab\.[ch]/s/^\([-a-zA-Z0-9_${}:"]*\.tab\)\.\([ch]\)/"{s}"\1.\2/ +# Fix some overenthusiasms. +/{s}/s/"{s}""{srcdir}"/"{srcdir}"/g +/{s}/s/"{s}"{\([a-zA-Z0-9_]*\)dir}/"{\1dir}"/g +/{s}/s/"{s}"{\([a-zA-Z0-9_]*\)DIR}/"{\1DIR}"/g +/{s}/s/"{s}""{\([a-zA-Z0-9_]*\)dir}"/"{\1dir}"/g +/{s}/s/"{s}""{\([a-zA-Z0-9_]*\)DIR}"/"{\1DIR}"/g +/{s}/s/"{s}":/:/g +/{s}/s/^"{s}"//g +/{s}/s/"{s}""{s}"/"{s}"/g +/{s}/s/"{s}""{srcdir}"/"{s}"/g +/{s}/s/"{srcdir}""{s}"/"{s}"/g + +# The .def files are also typically source files. +/\.def/s/\([ ><]\)\([-a-zA-Z0-9_${}:"]*\)\.def/\1"{s}"\2.def/g +/\.def/s/^\([-a-zA-Z0-9_${}:"]*\)\.def/"{s}"\1.def/g + +# Change extension and path of objects. +/\.o/s/\([ =]\)\([-a-zA-Z0-9_${}:"]*\)\.o/\1"{o}"\2.c.o/g +/\.o/s/^\([-a-zA-Z0-9_${}:"]*\)\.o/"{o}"\1.c.o/ +# Allow *.tab.o files as a special case of a 2-dot-name file. +/\.o/s/\([ =]\)\([-a-zA-Z0-9_${}:"]*\)\.tab\.o/\1"{o}"\2.tab.c.o/g +/\.o/s/^\([-a-zA-Z0-9_${}:"]*\)\.tab\.o/"{o}"\1.tab.c.o/ +# Clean up. +/"{o}"/s/"{o}""{o}"/"{o}"/g +/"{o}"/s/^"{o}"\([a-zA-Z0-9_]*\)=/\1=/ + +# Change extension of libs. +/\.a/s/lib\([a-z]*\)\.a/lib\1.o/g + +# Remove non-fail option. +/-/s/^\([ ]*\)-/\1/ +# Fix overeagernesses - assumes no one-letter commands. +/^[ ]*[a-z] /s/^\([ ]*\)\([a-z]\) /\1-\2 / + +# Remove non-echo option. (watch out for autoconf things) +/@/s/^\([ ]*\)@/\1/ + +# Change cp to Duplicate. +# Catenate is perhaps more accurate, but the pattern would have to +# identify the output file and add a '>' redirection into it. +/cp/s/^\([ ]*\)cp /\1Duplicate -d -y / +# Change mv to Rename. +/mv/s/^\([ ]*\)mv /\1Rename -y / +/Rename/s/^\([ ]*\)Rename -y -f/\1Rename -y/ +# Change rm to Delete. +/rm -rf/s/^\([ ]*\)rm -rf /\1Delete -i -y / +/rm -f/s/^\([ ]*\)rm -f /\1Delete -i -y / +/rm/s/^\([ ]*\)rm /\1Delete -i -y / +# Note that we don't mess with ln - directory-specific scripts +# must decide what to do with symlinks. +# Change cat to Catenate. +/cat/s/^\([ ]*\)cat /\1Catenate / +# Change touch to mpw-touch. +/touch/s/^\([ ]*\)touch /\1mpw-touch / +# Change mkdir to NewFolder. +/mkdir/s/^\([ ]*\)mkdir /\1NewFolder / +# Change var setting to Set. +/=/s/^\([ ]*\)\([-a-zA-Z0-9_]*\)=\([^;]*\); \\Option-d/\1Set \2 \3/ + +# Change tests. +/if /s/if \[ *-f \([^ ]*\) ] *; *\\Option-d/If "`Exists "\1"`" != ""/ +/if /s/if \[ *-f \([^ ]*\) ] *; *then *\\Option-d/If "`Exists "\1"`" != ""/ +/if /s/if \[ ! *-f \([^ ]*\) ] *; *\\Option-d/If "`Exists "\1"`" == ""/ +/if /s/if \[ ! *-f \([^ ]*\) ] *; *then \\Option-d/If "`Exists "\1"`" == ""/ + +/if /s/if \[ *-d \([^ ]*\) ] *; *\\Option-d/If "`Exists "\1"`" != ""/ +/if /s/if \[ *-d \([^ ]*\) ] *; *then *\\Option-d/If "`Exists "\1"`" != ""/ +/if /s/if \[ ! *-d \([^ ]*\) ] *; *\\Option-d/If "`Exists "\1"`" == ""/ +/if /s/if \[ ! *-d \([^ ]*\) ] *; *then *\\Option-d/If "`Exists "\1"`" == ""/ + +/if /s/if \[ -d \([^ ]*\) ] *; then true *; else mkdir \([^ ;]*\) *; fi/If "`Exists "\1"`" != "" NewFolder \2 End If/ + +/if /s/if \[ \([^ ]*\) = \([^ ]*\) ] *; *\\Option-d/If "\1" == "\2"/ +/if /s/if \[ \([^ ]*\) = \([^ ]*\) ] *; *then *\\Option-d/If "\1" == "\2"/ + +/if /s/if \[ \([^ ]*\) != \([^ ]*\) ] *; *\\Option-d/If "\1" != "\2"/ +/if /s/if \[ \([^ ]*\) != \([^ ]*\) ] *; *then *\\Option-d/If "\1" != "\2"/ + +/if /s/if \[ \([^ ]*\) -eq \([^ ]*\) ] *; *\\Option-d/If "\1" != "\2"/ +/if /s/if \[ \([^ ]*\) -eq \([^ ]*\) ] *; *then *\\Option-d/If "\1" != "\2"/ + +/^[ ]*else true$/c\ + Else\ + mpw-true\ + + +/else/s/^\([ ]*\)else[ ]*$/\1Else/ +/else/s/^\([ ]*\)else[; ]*\\Option-d$/\1Else/ + +/^[ ]*else[ ]*true[ ]*$/c\ + Else\ + mpw-true + +/^[ ]*else[ ]*true[; ]*fi$/c\ + Else\ + mpw-true\ + End If + +/fi/s/^\([ ]*\)fi *$/\1End/ +/fi/s/^\([ ]*\)fi *; *\\Option-d/\1End/ + +# Change looping. +/for/s/^\([ ]*\)for \([-a-zA-Z0-9_]*\) in \([^;]*\); *do *\\Option-d/\1For \2 In \3/ +/^\([ ]*\)do *\\Option-d/d +/done/s/^\([ ]*\)done *; *\\Option-d/\1End/ +/done/s/^\([ ]*\)done$/\1End/ + +# Trailing semicolons and continued lines are unneeded sh syntax. +/; \\Option-d/s/; \\Option-d// + +# Change move-if-change to MoveIfChange. +/move-if-change/s/\([^ ]*\)move-if-change/MoveIfChange/g + +# Change $(SHELL) to the script name by itself. +/SHELL/s/^\([ ]*\){SHELL} /\1/ + +# Change syntax of default rule dependency. +/^\.c\.o/s/^\.c\.o \\Option-f$/.c.o \\Option-f .c/ + +# Change default rule's action. +/{CC} -c/s/{CC} -c \(.*\) \$<$/{CC} @DASH_C_FLAG@ {DepDir}{Default}.c \1 @SEGMENT_FLAG({Default})@ -o {TargDir}{Default}.c.o/ + +# This is pretty disgusting, but I can't seem to detect empty rules. +/Option-f$/s/Option-f$/Option-f _oldest/g + +# Remove -c from explicit compiler calls. (but should not if GCC) +# Handle the case of a source file that is "{xxx}"file.c. +/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\)\.c/{\1CC}\2 @DASH_C_FLAG@ \3"\4"\5.c -o "{o}"\5.c.o/ +# Handle the case of a source file that is "{xxx}"dir:file.c. +/ -c /s/{\([A-Z_]*\)CC}\(.*\) -c \(.*\)"\([^"]*\)"\([-a-z_]*\):\([-a-z_]*\)\.c/{\1CC}\2 @DASH_C_FLAG@ \3"\4"\5:\6.c -o "{o}"\6.c.o/ + +# Change linking cc to linking sequence. +/-o/s/^\([ ]*\){CC} \(.*\){\([A-Z_]*\)CFLAGS} \(.*\){LDFLAGS} \(.*\)-o \([^ ]*\) \(.*\)$/\1{CC_LD} \2 {\3CFLAGS} \4 {LDFLAGS} \5 -o \6{PROG_EXT} \7\ +\1{MAKEPEF} \6{PROG_EXT} -o \6 {MAKEPEF_TOOL_FLAGS} {MAKEPEF_FLAGS}\ +\1{REZ} "{s}"\6.r -o \6 -append -d PROG_NAME='"'\6'"' -d VERSION_STRING='"'{version}'"'/ +/-o/s/^\([ ]*\){CC} \(.*\){\([A-Z_]*\)CFLAGS} \(.*\)-o \([^ ]*\) \(.*\){LDFLAGS} \(.*\)$/\1{CC_LD} \2 {\3CFLAGS} \4 {LDFLAGS} \6 -o \5{PROG_EXT} \7\ +\1{MAKEPEF} \5{PROG_EXT} -o \5 {MAKEPEF_TOOL_FLAGS} {MAKEPEF_FLAGS}\ +\1{REZ} "{s}"\5.r -o \5 -append -d PROG_NAME='"'\5'"' -d VERSION_STRING='"'{version}'"'/ +/-o/s/^\([ ]*\){HOST_CC} \(.*\)-o \([^ ]*\) \(.*\)$/\1{HOST_CC_LD} \2 -o \3{PROG_EXT} \4\ +\1{MAKEPEF} \3{PROG_EXT} -o \3 {MAKEPEF_TOOL_FLAGS} {MAKEPEF_FLAGS}\ +\1{REZ} "{s}"\3.r -o \3 -append -d PROG_NAME='"'\3'"' -d VERSION_STRING='"'{version}'"'/ + +# Comment out .NOEXPORT rules. +/\.NOEXPORT/s/^\.NOEXPORT/#\.NOEXPORT/ +# Comment out .PHONY rules. +/\.PHONY/s/^\.PHONY/#\.PHONY/ +# Comment out .PRECIOUS rules. +/\.PRECIOUS/s/^\.PRECIOUS/#\.PRECIOUS/ +# Comment out .SUFFIXES rules. +/\.SUFFIXES/s/^\.SUFFIXES/#\.SUFFIXES/ + +# Set the install program appropriately. +/INSTALL/s/^INSTALL *= *`.*`:install.sh -c/INSTALL = Duplicate -y/ + +# Don't try to decide whether to use the tree's own tools. +/bison/s/`.*bison:bison.*`/bison -y/ +/byacc/s/`.*byacc:byacc.*`/byacc/ +/flex/s/`.*flex:flex.*`/flex/ + +# Turn transformed C comments in echo commands back into comments. +/echo/s,echo '\(.*\):\\Option-x\(.*\)\\Option-x:\(.*\)',echo '\1/*\2*/\3', + +# Whack out various clever expressions that search for tools, since +# the clever code is too /bin/sh specific. + +/^AR_FOR_TARGET = `/,/`$/c\ +AR_FOR_TARGET = ::binutils:ar\ + + +/^RANLIB_FOR_TARGET = `/,/`$/c\ +RANLIB_FOR_TARGET = ::binutils:ranlib\ + + +/^RANLIB_TEST_FOR_TARGET = /,/ranlib ] )$/c\ +RANLIB_TEST_FOR_TARGET = \ + + +/^EXPECT = `/,/`$/c\ +EXPECT = \ + + +/^RUNTEST = `/,/`$/c\ +RUNTEST = \ + + +/^CC_FOR_TARGET = `/,/`$/c\ +CC_FOR_TARGET = \ + + +/^CXX_FOR_TARGET = `/,/`$/c\ +CXX_FOR_TARGET = \ + + +/^CHILL_FOR_TARGET = `/,/`$/c\ +CHILL_FOR_TARGET = \ + + +/^CHILL_LIB = `/,/`$/c\ +CHILL_LIB = \ + +/sanit/s/{start-sanit...-[a-z0-9]*}// +/sanit/s/{end-sanit...-[a-z0-9]*}// + +# Add standard defines and default rules. +/^# srcdir/a\ +\ +s = "{srcdir}"\ +\ +o = :\ +\ +"{o}" \\Option-f : "{s}" + diff --git a/config/mpw/mpw-touch b/config/mpw/mpw-touch new file mode 100644 index 000000000..c743a5122 --- /dev/null +++ b/config/mpw/mpw-touch @@ -0,0 +1,7 @@ +# "Touch" command. + +If "`Exists "{1}"`" != "" + SetFile -m . "{1}" +Else + Echo ' ' > "{1}" +End If diff --git a/config/mpw/mpw-true b/config/mpw/mpw-true new file mode 100644 index 000000000..0506530d3 --- /dev/null +++ b/config/mpw/mpw-true @@ -0,0 +1 @@ +Exit 0 diff --git a/config/mpw/null-command b/config/mpw/null-command new file mode 100644 index 000000000..4844c8ec5 --- /dev/null +++ b/config/mpw/null-command @@ -0,0 +1 @@ +# This command does nothing. diff --git a/config/mpw/open-brace b/config/mpw/open-brace new file mode 100644 index 000000000..58465dcc1 --- /dev/null +++ b/config/mpw/open-brace @@ -0,0 +1,4 @@ +# MPW makefiles seem not to have any way to get a literal open +# brace into a rule anywhere, so this does the job. + +Echo '{' diff --git a/config/mpw/tr-7to8-src b/config/mpw/tr-7to8-src new file mode 100644 index 000000000..b20b649c8 --- /dev/null +++ b/config/mpw/tr-7to8-src @@ -0,0 +1,9 @@ +StreamEdit -e \Option-d + '/\Option-x/ \Option-d + Replace /\Option-d\SrcOption-d/ "\Option-d\Option-d" -c \Option-5 ; \Option-d + Replace /\Option-d\SrcOption-f/ "\Option-d\Option-f" -c \Option-5 ; \Option-d + Replace /\Option-d\SrcOption-8/ "\Option-d\Option-8" -c \Option-5 ; \Option-d + Replace /\Option-d\SrcOption-5/ "\Option-d\Option-5" -c \Option-5 ; \Option-d + Replace /\Option-d\SrcOption-x/ "\Option-d\Option-x" -c \Option-5 ; \Option-d + Replace /\Option-d\SrcOption-r/ "\Option-d\Option-r" -c \Option-5' \Option-d + "{1}" diff --git a/config/mpw/true b/config/mpw/true new file mode 100644 index 000000000..0506530d3 --- /dev/null +++ b/config/mpw/true @@ -0,0 +1 @@ +Exit 0 -- cgit v1.2.3