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*: |
Martin v. Löwis | 1a21451 | 2008-06-11 05:26:20 +0000 | [diff] [blame] | 27 | # + insert 'extern PyObject* PyInit_<module>(void);' before MARKER 1 |
| 28 | # + insert '{"<module>", PyInit_<module>},' before MARKER 2 |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 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 | |
Martin Panter | 2dc77f0 | 2016-09-16 00:46:05 +0000 | [diff] [blame] | 85 | # Setup to link with extra libraries when making shared extensions. |
Guido van Rossum | b961920 | 2001-01-10 21:12:18 +0000 | [diff] [blame] | 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 |
Ned Deily | b166191 | 2014-06-02 01:05:29 -0700 | [diff] [blame] | 220 | no) cc="$cc \$(CCSHARED) \$(PY_CFLAGS) \$(PY_CPPFLAGS)";; |
Neil Schemenauer | 83356ef | 2001-01-26 16:22:26 +0000 | [diff] [blame] | 221 | *) |
Jeffrey Yasskin | d4fcdb1 | 2010-07-09 16:30:58 +0000 | [diff] [blame] | 222 | cc="$cc \$(PY_CORE_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 |
Ned Deily | b166191 | 2014-06-02 01:05:29 -0700 | [diff] [blame] | 232 | file="$srcdir/$mod\$(EXT_SUFFIX)" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 233 | case $doconfig in |
| 234 | no) SHAREDMODS="$SHAREDMODS $file";; |
| 235 | esac |
| 236 | rule="$file: $objs" |
Thomas Wouters | 89d996e | 2007-09-08 17:39:28 +0000 | [diff] [blame] | 237 | rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file" |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 238 | echo "$rule" >>$rulesf |
| 239 | done |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 240 | done |
| 241 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 242 | case $SHAREDMODS in |
| 243 | '') ;; |
| 244 | *) DEFS="SHAREDMODS=$SHAREDMODS$NL$DEFS";; |
| 245 | esac |
| 246 | |
Guido van Rossum | 0b498be | 1994-08-23 13:49:15 +0000 | [diff] [blame] | 247 | case $noobjects in |
| 248 | yes) BASELIBS=$LIBS;; |
| 249 | *) LOCALLIBS=$LIBS;; |
| 250 | esac |
| 251 | LIBS='$(LOCALMODLIBS) $(BASEMODLIBS)' |
| 252 | DEFS="BASEMODLIBS=$BASELIBS$NL$DEFS" |
| 253 | DEFS="LOCALMODLIBS=$LOCALLIBS$NL$DEFS" |
| 254 | |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 255 | EXTDECLS= |
| 256 | INITBITS= |
| 257 | for mod in $MODS |
| 258 | do |
Martin v. Löwis | 1a21451 | 2008-06-11 05:26:20 +0000 | [diff] [blame] | 259 | EXTDECLS="${EXTDECLS}extern PyObject* PyInit_$mod(void);$NL" |
| 260 | INITBITS="${INITBITS} {\"$mod\", PyInit_$mod},$NL" |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 261 | done |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 262 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 263 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 264 | case $config in |
| 265 | -) ;; |
| 266 | *) sed -e " |
| 267 | 1i$NL/* Generated automatically from $config by makesetup. */ |
| 268 | /MARKER 1/i$NL$EXTDECLS |
Serhiy Storchaka | bfbfc8d | 2015-03-29 19:12:58 +0300 | [diff] [blame] | 269 | |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 270 | /MARKER 2/i$NL$INITBITS |
| 271 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 272 | " $config >config.c |
| 273 | ;; |
| 274 | esac |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 275 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 276 | case $makepre in |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 277 | -) ;; |
| 278 | *) sedf="@sed.in.$$" |
| 279 | trap 'rm -f $sedf' 0 1 2 3 |
| 280 | echo "1i\\" >$sedf |
| 281 | str="# Generated automatically from $makepre by makesetup." |
| 282 | echo "$str" >>$sedf |
Guido van Rossum | 3bbc62e | 1995-01-02 19:30:30 +0000 | [diff] [blame] | 283 | echo "s%_MODOBJS_%$OBJS%" >>$sedf |
| 284 | echo "s%_MODLIBS_%$LIBS%" >>$sedf |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 285 | echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf |
| 286 | sed -f $sedf $makepre >Makefile |
| 287 | cat $rulesf >>Makefile |
| 288 | rm -f $sedf |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 289 | ;; |
| 290 | esac |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 291 | |
Guido van Rossum | 7cc5abd | 1994-09-12 10:42:20 +0000 | [diff] [blame] | 292 | rm -f $rulesf |
Guido van Rossum | fba715a | 1994-01-02 00:26:09 +0000 | [diff] [blame] | 293 | ) |