Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 3 | # Convert templates into Makefile and config.c, based on the module |
| 4 | # definitions found in the file Setup. |
| 5 | # |
| 6 | # Usage: makesetup [-s dir] [-c file] [-m file] [Setup] ... [-n [Setup] ...] |
| 7 | # |
| 8 | # Options: |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 9 | # -s directory: alternative source directory (default .) |
| 10 | # -l directory: library source directory (default derived from $0) |
| 11 | # -c file: alternative config.c template (default $libdir/config.c.in) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 12 | # -c -: don't write config.c |
| 13 | # -m file: alternative Makefile template (default ./Makefile.pre) |
| 14 | # -m -: don't write Makefile |
| 15 | # |
| 16 | # Remaining arguments are one or more Setup files (default ./Setup). |
| 17 | # Setup files after a -n option are used for their variables, modules |
| 18 | # and libraries but not for their .o files. |
| 19 | # |
Fred Drake | cf3bc8c | 2000-10-26 17:07:40 +0000 | [diff] [blame] | 20 | # See Setup.dist for a description of the format of the Setup file. |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 21 | # |
| 22 | # The following edits are made: |
| 23 | # |
| 24 | # Copying config.c.in to config.c: |
| 25 | # - insert an identifying comment at the start |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 26 | # - for each <module> mentioned in Setup before *noconfig*: |
Thomas Wouters | 53e7fd7 | 2000-07-23 00:02:15 +0000 | [diff] [blame] | 27 | # + insert 'extern void init<module>(void);' before MARKER 1 |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 28 | # + insert '{"<module>", initmodule},' before MARKER 2 |
| 29 | # |
| 30 | # Copying Makefile.pre to Makefile: |
| 31 | # - insert an identifying comment at the start |
Guido van Rossum | 3bbc62e | 1995-01-02 19:30:30 +0000 | [diff] [blame] | 32 | # - replace _MODOBJS_ by the list of objects from Setup (except for |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 33 | # Setup files after a -n option) |
Guido van Rossum | 3bbc62e | 1995-01-02 19:30:30 +0000 | [diff] [blame] | 34 | # - replace _MODLIBS_ by the list of libraries from Setup |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 35 | # - for each object file mentioned in Setup, append a rule |
| 36 | # '<file>.o: <file>.c; <build commands>' to the end of the Makefile |
| 37 | # - for each module mentioned in Setup, append a rule |
| 38 | # which creates a shared library version to the end of the Makefile |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 39 | # - for each variable definition found in Setup, insert the definition |
| 40 | # before the comment 'Definitions added by makesetup' |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 41 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 42 | # Loop over command line options |
| 43 | usage=' |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 44 | usage: makesetup [-s srcdir] [-l libdir] [-c config.c.in] [-m Makefile.pre] |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 45 | [Setup] ... [-n [Setup] ...]' |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 46 | srcdir='.' |
| 47 | libdir='' |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 48 | config='' |
| 49 | makepre='' |
| 50 | noobjects='' |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 51 | doconfig=yes |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 52 | while : |
| 53 | do |
| 54 | case $1 in |
| 55 | -s) shift; srcdir=$1; shift;; |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 56 | -l) shift; libdir=$1; shift;; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 57 | -c) shift; config=$1; shift;; |
| 58 | -m) shift; makepre=$1; shift;; |
| 59 | --) shift; break;; |
| 60 | -n) noobjects=yes;; |
| 61 | -*) echo "$usage" 1>&2; exit 2;; |
| 62 | *) break;; |
| 63 | esac |
| 64 | done |
| 65 | |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 66 | # Set default libdir and config if not set by command line |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 67 | # (Not all systems have dirname) |
Neil Schemenauer | 09ac1fd | 2001-01-27 21:43:40 +0000 | [diff] [blame] | 68 | case $libdir in |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 69 | '') case $0 in |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 70 | */*) libdir=`echo $0 | sed 's,/[^/]*$,,'`;; |
| 71 | *) libdir=.;; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 72 | esac;; |
| 73 | esac |
| 74 | case $config in |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 75 | '') config=$libdir/config.c.in;; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 76 | esac |
| 77 | case $makepre in |
| 78 | '') makepre=Makefile.pre;; |
| 79 | esac |
| 80 | |
| 81 | # Newline for sed i and a commands |
Guido van Rossum | 4a26986 | 1995-06-14 22:52:06 +0000 | [diff] [blame] | 82 | NL='\ |
| 83 | ' |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 84 | |
Guido van Rossum | b961920 | 2001-01-10 21:12:18 +0000 | [diff] [blame] | 85 | # Setup to link with extra libraries when makeing shared extensions. |
| 86 | # Currently, only Cygwin needs this baggage. |
| 87 | case `uname -s` in |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 88 | CYGWIN*) if test $libdir = . |
Guido van Rossum | b961920 | 2001-01-10 21:12:18 +0000 | [diff] [blame] | 89 | then |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 90 | ExtraLibDir=. |
Guido van Rossum | b961920 | 2001-01-10 21:12:18 +0000 | [diff] [blame] | 91 | else |
| 92 | ExtraLibDir='$(LIBPL)' |
| 93 | fi |
| 94 | ExtraLibs="-L$ExtraLibDir -lpython\$(VERSION)";; |
| 95 | esac |
| 96 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 97 | # Main loop |
| 98 | for i in ${*-Setup} |
| 99 | do |
| 100 | case $i in |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 101 | -n) echo '*noobjects*';; |
| 102 | *) echo '*doconfig*'; cat "$i";; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 103 | esac |
| 104 | done | |
| 105 | sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' | |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 106 | ( |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 107 | rulesf="@rules.$$" |
| 108 | trap 'rm -f $rulesf' 0 1 2 3 |
| 109 | echo " |
| 110 | # Rules appended by makedepend |
| 111 | " >$rulesf |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 112 | DEFS= |
| 113 | MODS= |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 114 | SHAREDMODS= |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 115 | OBJS= |
| 116 | LIBS= |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 117 | LOCALLIBS= |
| 118 | BASELIBS= |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 119 | while read line |
| 120 | do |
Guido van Rossum | ae84e8d | 1999-04-19 17:16:12 +0000 | [diff] [blame] | 121 | # to handle backslashes for sh's that don't automatically |
| 122 | # continue a read when the last char is a backslash |
| 123 | while echo $line | grep '\\$' > /dev/null |
| 124 | do |
| 125 | read extraline |
| 126 | line=`echo $line| sed s/.$//`$extraline |
| 127 | done |
| 128 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 129 | # Output DEFS in reverse order so first definition overrides |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 130 | case $line in |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 131 | *=*) DEFS="$line$NL$DEFS"; continue;; |
Guido van Rossum | 9bf8445 | 1997-04-02 05:33:00 +0000 | [diff] [blame] | 132 | 'include '*) DEFS="$line$NL$DEFS"; continue;; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 133 | '*noobjects*') |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 134 | case $noobjects in |
| 135 | yes) ;; |
| 136 | *) LOCALLIBS=$LIBS; LIBS=;; |
| 137 | esac |
| 138 | noobjects=yes; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 139 | continue;; |
| 140 | '*doconfig*') doconfig=yes; continue;; |
Guido van Rossum | 4355454 | 1996-08-20 19:49:13 +0000 | [diff] [blame] | 141 | '*static*') doconfig=yes; continue;; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 142 | '*noconfig*') doconfig=no; continue;; |
Guido van Rossum | 4355454 | 1996-08-20 19:49:13 +0000 | [diff] [blame] | 143 | '*shared*') doconfig=no; continue;; |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 144 | esac |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 145 | srcs= |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 146 | cpps= |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 147 | libs= |
| 148 | mods= |
Guido van Rossum | 4a26986 | 1995-06-14 22:52:06 +0000 | [diff] [blame] | 149 | skip= |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 150 | for arg in $line |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 151 | do |
Guido van Rossum | 4a26986 | 1995-06-14 22:52:06 +0000 | [diff] [blame] | 152 | case $skip in |
| 153 | libs) libs="$libs $arg"; skip=; continue;; |
| 154 | cpps) cpps="$cpps $arg"; skip=; continue;; |
| 155 | srcs) srcs="$srcs $arg"; skip=; continue;; |
| 156 | esac |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 157 | case $arg in |
Guido van Rossum | 2a78cf2 | 2001-01-10 21:46:05 +0000 | [diff] [blame] | 158 | -framework) libs="$libs $arg"; skip=libs; |
| 159 | # OSX/OSXS/Darwin framework link cmd |
| 160 | ;; |
| 161 | -[IDUCfF]*) cpps="$cpps $arg";; |
Andrew M. Kuchling | f4a4fb9 | 2002-03-29 18:00:19 +0000 | [diff] [blame] | 162 | -Xcompiler) skip=cpps;; |
Guido van Rossum | b447d11 | 1997-12-02 20:38:11 +0000 | [diff] [blame] | 163 | -Xlinker) libs="$libs $arg"; skip=libs;; |
Guido van Rossum | 8bfefce | 1999-05-21 19:18:49 +0000 | [diff] [blame] | 164 | -rpath) libs="$libs $arg"; skip=libs;; |
Fred Drake | 091ec2c | 2000-08-11 13:58:37 +0000 | [diff] [blame] | 165 | --rpath) libs="$libs $arg"; skip=libs;; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 166 | -[A-Zl]*) libs="$libs $arg";; |
| 167 | *.a) libs="$libs $arg";; |
Guido van Rossum | a29756c | 1996-08-19 22:00:05 +0000 | [diff] [blame] | 168 | *.so) libs="$libs $arg";; |
| 169 | *.sl) libs="$libs $arg";; |
Guido van Rossum | fa1fb7d | 1998-05-14 02:37:45 +0000 | [diff] [blame] | 170 | /*.o) libs="$libs $arg";; |
Guido van Rossum | b961920 | 2001-01-10 21:12:18 +0000 | [diff] [blame] | 171 | *.def) libs="$libs $arg";; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 172 | *.o) srcs="$srcs `basename $arg .o`.c";; |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 173 | *.[cC]) srcs="$srcs $arg";; |
Guido van Rossum | 2a78cf2 | 2001-01-10 21:46:05 +0000 | [diff] [blame] | 174 | *.m) srcs="$srcs $arg";; # Objective-C src |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 175 | *.cc) srcs="$srcs $arg";; |
| 176 | *.c++) srcs="$srcs $arg";; |
Guido van Rossum | babacb0 | 1997-02-14 16:44:04 +0000 | [diff] [blame] | 177 | *.cxx) srcs="$srcs $arg";; |
| 178 | *.cpp) srcs="$srcs $arg";; |
Sjoerd Mullender | 4237efc | 1995-10-11 08:45:15 +0000 | [diff] [blame] | 179 | \$*) libs="$libs $arg" |
| 180 | cpps="$cpps $arg";; |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 181 | *.*) echo 1>&2 "bad word $arg in $line" |
| 182 | exit 1;; |
Guido van Rossum | 4a26986 | 1995-06-14 22:52:06 +0000 | [diff] [blame] | 183 | -u) skip=libs; libs="$libs -u";; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 184 | [a-zA-Z_]*) mods="$mods $arg";; |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 185 | *) echo 1>&2 "bad word $arg in $line" |
| 186 | exit 1;; |
| 187 | esac |
| 188 | done |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 189 | case $doconfig in |
| 190 | yes) |
| 191 | LIBS="$LIBS $libs" |
| 192 | MODS="$MODS $mods" |
| 193 | ;; |
| 194 | esac |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 195 | case $noobjects in |
| 196 | yes) continue;; |
| 197 | esac |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 198 | objs='' |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 199 | for src in $srcs |
| 200 | do |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 201 | case $src in |
| 202 | *.c) obj=`basename $src .c`.o; cc='$(CC)';; |
Guido van Rossum | 37da22b | 2000-12-06 23:46:29 +0000 | [diff] [blame] | 203 | *.cc) obj=`basename $src .cc`.o; cc='$(CXX)';; |
| 204 | *.c++) obj=`basename $src .c++`.o; cc='$(CXX)';; |
| 205 | *.C) obj=`basename $src .C`.o; cc='$(CXX)';; |
| 206 | *.cxx) obj=`basename $src .cxx`.o; cc='$(CXX)';; |
| 207 | *.cpp) obj=`basename $src .cpp`.o; cc='$(CXX)';; |
Guido van Rossum | ad2c3c7 | 2001-03-02 07:09:54 +0000 | [diff] [blame] | 208 | *.m) obj=`basename $src .m`.o; cc='$(CC)';; # Obj-C |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 209 | *) continue;; |
| 210 | esac |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 211 | obj="$srcdir/$obj" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 212 | objs="$objs $obj" |
| 213 | case $src in |
| 214 | glmodule.c) ;; |
Guido van Rossum | 76d1f96 | 1998-09-09 14:04:51 +0000 | [diff] [blame] | 215 | /*) ;; |
Skip Montanaro | fd02267 | 2000-07-06 17:58:06 +0000 | [diff] [blame] | 216 | \$*) ;; |
Neil Schemenauer | d32a337 | 2001-01-24 17:16:22 +0000 | [diff] [blame] | 217 | *) src='$(srcdir)/'"$srcdir/$src";; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 218 | esac |
| 219 | case $doconfig in |
Neil Schemenauer | 89e90d6 | 2001-06-02 06:16:02 +0000 | [diff] [blame] | 220 | no) cc="$cc \$(CCSHARED) \$(CFLAGS) \$(CPPFLAGS)";; |
Neil Schemenauer | 83356ef | 2001-01-26 16:22:26 +0000 | [diff] [blame] | 221 | *) |
| 222 | cc="$cc \$(PY_CFLAGS)";; |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 223 | esac |
Neil Schemenauer | 83356ef | 2001-01-26 16:22:26 +0000 | [diff] [blame] | 224 | rule="$obj: $src; $cc $cpps -c $src -o $obj" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 225 | echo "$rule" >>$rulesf |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 226 | done |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 227 | case $doconfig in |
| 228 | yes) OBJS="$OBJS $objs";; |
| 229 | esac |
| 230 | for mod in $mods |
| 231 | do |
| 232 | case $objs in |
| 233 | *$mod.o*) base=$mod;; |
| 234 | *) base=${mod}module;; |
| 235 | esac |
Neil Schemenauer | 83356ef | 2001-01-26 16:22:26 +0000 | [diff] [blame] | 236 | file="$srcdir/$base\$(SO)" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 237 | case $doconfig in |
| 238 | no) SHAREDMODS="$SHAREDMODS $file";; |
| 239 | esac |
| 240 | rule="$file: $objs" |
Martin v. Löwis | d44a4e9 | 2007-09-05 11:47:34 +0000 | [diff] [blame] | 241 | rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 242 | echo "$rule" >>$rulesf |
| 243 | done |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 244 | done |
| 245 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 246 | case $SHAREDMODS in |
| 247 | '') ;; |
| 248 | *) DEFS="SHAREDMODS=$SHAREDMODS$NL$DEFS";; |
| 249 | esac |
| 250 | |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 251 | case $noobjects in |
| 252 | yes) BASELIBS=$LIBS;; |
| 253 | *) LOCALLIBS=$LIBS;; |
| 254 | esac |
| 255 | LIBS='$(LOCALMODLIBS) $(BASEMODLIBS)' |
| 256 | DEFS="BASEMODLIBS=$BASELIBS$NL$DEFS" |
| 257 | DEFS="LOCALMODLIBS=$LOCALLIBS$NL$DEFS" |
| 258 | |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 259 | EXTDECLS= |
| 260 | INITBITS= |
| 261 | for mod in $MODS |
| 262 | do |
Thomas Wouters | 53e7fd7 | 2000-07-23 00:02:15 +0000 | [diff] [blame] | 263 | EXTDECLS="${EXTDECLS}extern void init$mod(void);$NL" |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 264 | INITBITS="${INITBITS} {\"$mod\", init$mod},$NL" |
| 265 | done |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 266 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 267 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 268 | case $config in |
| 269 | -) ;; |
| 270 | *) sed -e " |
| 271 | 1i$NL/* Generated automatically from $config by makesetup. */ |
| 272 | /MARKER 1/i$NL$EXTDECLS |
Guido van Rossum | 3886bb6 | 1998-12-04 18:50:17 +0000 | [diff] [blame] | 273 | |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 274 | /MARKER 2/i$NL$INITBITS |
| 275 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 276 | " $config >config.c |
| 277 | ;; |
| 278 | esac |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 279 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 280 | case $makepre in |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 281 | -) ;; |
| 282 | *) sedf="@sed.in.$$" |
| 283 | trap 'rm -f $sedf' 0 1 2 3 |
| 284 | echo "1i\\" >$sedf |
| 285 | str="# Generated automatically from $makepre by makesetup." |
| 286 | echo "$str" >>$sedf |
Guido van Rossum | 3bbc62e | 1995-01-02 19:30:30 +0000 | [diff] [blame] | 287 | echo "s%_MODOBJS_%$OBJS%" >>$sedf |
| 288 | echo "s%_MODLIBS_%$LIBS%" >>$sedf |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 289 | echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf |
| 290 | sed -f $sedf $makepre >Makefile |
| 291 | cat $rulesf >>Makefile |
| 292 | rm -f $sedf |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 293 | ;; |
| 294 | esac |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 295 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 296 | rm -f $rulesf |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 297 | ) |