annotate Modules/makesetup @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents 12373ba24e5d
children 80735fcc35af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #! /bin/sh
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
3 # Convert templates into Makefile and config.c, based on the module
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
4 # definitions found in the file Setup.
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
5 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
6 # Usage: makesetup [-s dir] [-c file] [-m file] [Setup] ... [-n [Setup] ...]
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
7 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
8 # Options:
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
9 # -s directory: alternative source directory (default derived from $0)
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
10 # -c file: alternative config.c template (default $srcdir/config.c.in)
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
11 # -c -: don't write config.c
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
12 # -m file: alternative Makefile template (default ./Makefile.pre)
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
13 # -m -: don't write Makefile
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
14 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
15 # Remaining arguments are one or more Setup files (default ./Setup).
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
16 # Setup files after a -n option are used for their variables, modules
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
17 # and libraries but not for their .o files.
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
18 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
19 # See Setup.in for a description of the format of the Setup file.
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
20 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
21 # The following edits are made:
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
22 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
23 # Copying config.c.in to config.c:
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
24 # - insert an identifying comment at the start
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
25 # - for each <module> mentioned in Setup before *noconfig*:
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
26 # + insert 'extern void init<module>();' before MARKER 1
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
27 # + insert '{"<module>", initmodule},' before MARKER 2
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
28 #
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
29 # Copying Makefile.pre to Makefile:
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
30 # - insert an identifying comment at the start
2055
cf31eab6ab5a Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents: 1984
diff changeset
31 # - replace _MODOBJS_ by the list of objects from Setup (except for
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
32 # Setup files after a -n option)
2055
cf31eab6ab5a Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents: 1984
diff changeset
33 # - replace _MODLIBS_ by the list of libraries from Setup
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
34 # - for each object file mentioned in Setup, append a rule
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
35 # '<file>.o: <file>.c; <build commands>' to the end of the Makefile
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
36 # - for each module mentioned in Setup, append a rule
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
37 # which creates a shared library version to the end of the Makefile
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
38 # - for each variable definition found in Setup, insert the definition
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
39 # before the comment 'Definitions added by makesetup'
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
40
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
41 # Loop over command line options
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
42 usage='
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
43 usage: makesetup [-s srcdir] [-c config.c.in] [-m Makefile.pre]
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
44 [Setup] ... [-n [Setup] ...]'
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
45 srcdir=''
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
46 config=''
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
47 makepre=''
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
48 noobjects=''
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
49 doconfig=yes
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
50 while :
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
51 do
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
52 case $1 in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
53 -s) shift; srcdir=$1; shift;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
54 -c) shift; config=$1; shift;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
55 -m) shift; makepre=$1; shift;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
56 --) shift; break;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
57 -n) noobjects=yes;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
58 -*) echo "$usage" 1>&2; exit 2;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
59 *) break;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
60 esac
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
61 done
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
62
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
63 # Set default srcdir and config if not set by command line
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
64 # (Not all systems have dirname)
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
65 case $srcdir in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
66 '') case $0 in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
67 */*) srcdir=`echo $0 | sed 's,/[^/]*$,,'`;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
68 *) srcdir=.;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
69 esac;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
70 esac
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
71 case $config in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
72 '') config=$srcdir/config.c.in;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
73 esac
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
74 case $makepre in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
75 '') makepre=Makefile.pre;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
76 esac
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
77
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
78 # Newline for sed i and a commands
2739
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
79 NL='\
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
80 '
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
81
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
82 # Main loop
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
83 for i in ${*-Setup}
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
84 do
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
85 case $i in
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
86 -n) echo '*noobjects*';;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
87 *) echo '*doconfig*'; cat "$i";;
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
88 esac
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
89 done |
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
90 sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 (
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
92 rulesf="@rules.$$"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
93 trap 'rm -f $rulesf' 0 1 2 3
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
94 echo "
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
95 # Rules appended by makedepend
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
96 " >$rulesf
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 DEFS=
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
98 MODS=
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
99 SHAREDMODS=
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 OBJS=
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
101 LIBS=
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
102 LOCALLIBS=
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
103 BASELIBS=
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
104 while read line
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
105 do
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
106 # Output DEFS in reverse order so first definition overrides
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
107 case $line in
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
108 *=*) DEFS="$line$NL$DEFS"; continue;;
5237
12373ba24e5d Support include statement :-(
Guido van Rossum <guido@python.org>
parents: 5104
diff changeset
109 'include '*) DEFS="$line$NL$DEFS"; continue;;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
110 '*noobjects*')
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
111 case $noobjects in
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
112 yes) ;;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
113 *) LOCALLIBS=$LIBS; LIBS=;;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
114 esac
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
115 noobjects=yes;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
116 continue;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
117 '*doconfig*') doconfig=yes; continue;;
4063
a589cedcbef5 Support *shared* and *static* as aliases for *noconfig* and *config*.
Guido van Rossum <guido@python.org>
parents: 4032
diff changeset
118 '*static*') doconfig=yes; continue;;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
119 '*noconfig*') doconfig=no; continue;;
4063
a589cedcbef5 Support *shared* and *static* as aliases for *noconfig* and *config*.
Guido van Rossum <guido@python.org>
parents: 4032
diff changeset
120 '*shared*') doconfig=no; continue;;
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
121 esac
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
122 srcs=
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
123 cpps=
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
124 libs=
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
125 mods=
2739
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
126 skip=
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
127 for arg in $line
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
128 do
2739
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
129 case $skip in
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
130 libs) libs="$libs $arg"; skip=; continue;;
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
131 cpps) cpps="$cpps $arg"; skip=; continue;;
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
132 srcs) srcs="$srcs $arg"; skip=; continue;;
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
133 esac
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
134 case $arg in
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
135 -[IDUC]*) cpps="$cpps $arg";;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
136 -[A-Zl]*) libs="$libs $arg";;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
137 *.a) libs="$libs $arg";;
4032
893949d1d28e Recognize *.sl and *.so as library (i.e. linker) arguments
Guido van Rossum <guido@python.org>
parents: 3195
diff changeset
138 *.so) libs="$libs $arg";;
893949d1d28e Recognize *.sl and *.so as library (i.e. linker) arguments
Guido van Rossum <guido@python.org>
parents: 3195
diff changeset
139 *.sl) libs="$libs $arg";;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
140 *.o) srcs="$srcs `basename $arg .o`.c";;
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
141 *.[cC]) srcs="$srcs $arg";;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
142 *.cc) srcs="$srcs $arg";;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
143 *.c++) srcs="$srcs $arg";;
5104
4109a171c901 Added .cxx and .cpp to extensions recognized as source files.
Guido van Rossum <guido@python.org>
parents: 4063
diff changeset
144 *.cxx) srcs="$srcs $arg";;
4109a171c901 Added .cxx and .cpp to extensions recognized as source files.
Guido van Rossum <guido@python.org>
parents: 4063
diff changeset
145 *.cpp) srcs="$srcs $arg";;
3195
61193c632f51 Propagate variable calls both to the linker and the compiler.
Sjoerd Mullender <sjoerd@acm.org>
parents: 2739
diff changeset
146 \$*) libs="$libs $arg"
61193c632f51 Propagate variable calls both to the linker and the compiler.
Sjoerd Mullender <sjoerd@acm.org>
parents: 2739
diff changeset
147 cpps="$cpps $arg";;
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
148 *.*) echo 1>&2 "bad word $arg in $line"
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
149 exit 1;;
2739
80b5c82272a2 fix NL for Linux bash bug; special processing for -u options
Guido van Rossum <guido@python.org>
parents: 2055
diff changeset
150 -u) skip=libs; libs="$libs -u";;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
151 [a-zA-Z_]*) mods="$mods $arg";;
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
152 *) echo 1>&2 "bad word $arg in $line"
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
153 exit 1;;
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
154 esac
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
155 done
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
156 case $doconfig in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
157 yes)
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
158 LIBS="$LIBS $libs"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
159 MODS="$MODS $mods"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
160 ;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
161 esac
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
162 case $noobjects in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
163 yes) continue;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
164 esac
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
165 objs=''
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
166 for src in $srcs
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
167 do
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
168 case $src in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
169 *.c) obj=`basename $src .c`.o; cc='$(CC)';;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
170 *.cc) obj=`basename $src .cc`.o; cc='$(CCC)';;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
171 *.c++) obj=`basename $src .c++`.o; cc='$(CCC)';;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
172 *.C) obj=`basename $src .C`.o; cc='$(CCC)';;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
173 *) continue;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
174 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
175 objs="$objs $obj"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
176 case $src in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
177 glmodule.c) ;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
178 *) src='$(srcdir)/'$src;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
179 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
180 case $doconfig in
1984
40611cacd5bd makesetup should use $cc not cc
Guido van Rossum <guido@python.org>
parents: 1980
diff changeset
181 no) cc="$cc \$(CCSHARED)";;
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
182 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
183 rule="$obj: $src; $cc \$(CFLAGS) $cpps -c $src"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
184 echo "$rule" >>$rulesf
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
185 done
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
186 case $doconfig in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
187 yes) OBJS="$OBJS $objs";;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
188 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
189 for mod in $mods
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
190 do
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
191 case $objs in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
192 *$mod.o*) base=$mod;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
193 *) base=${mod}module;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
194 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
195 file="$base\$(SO)"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
196 case $doconfig in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
197 no) SHAREDMODS="$SHAREDMODS $file";;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
198 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
199 rule="$file: $objs"
1980
2347b1fe812d Escaped $(LDSHARED) in a string.
Sjoerd Mullender <sjoerd@acm.org>
parents: 1883
diff changeset
200 rule="$rule; \$(LDSHARED) $objs $libs -o $file"
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
201 echo "$rule" >>$rulesf
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
202 done
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
203 done
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
204
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
205 case $SHAREDMODS in
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
206 '') ;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
207 *) DEFS="SHAREDMODS=$SHAREDMODS$NL$DEFS";;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
208 esac
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
209
1816
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
210 case $noobjects in
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
211 yes) BASELIBS=$LIBS;;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
212 *) LOCALLIBS=$LIBS;;
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
213 esac
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
214 LIBS='$(LOCALMODLIBS) $(BASEMODLIBS)'
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
215 DEFS="BASEMODLIBS=$BASELIBS$NL$DEFS"
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
216 DEFS="LOCALMODLIBS=$LOCALLIBS$NL$DEFS"
3b4703173caf * Modules/makesetup: support C++ files now; these should be given
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
217
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
218 EXTDECLS=
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
219 INITBITS=
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
220 for mod in $MODS
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
221 do
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
222 EXTDECLS="${EXTDECLS}extern void init$mod();$NL"
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
223 INITBITS="${INITBITS} {\"$mod\", init$mod},$NL"
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
224 done
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
225
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
226
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
227 case $config in
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
228 -) ;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
229 *) sed -e "
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
230 1i$NL/* Generated automatically from $config by makesetup. */
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
231 /MARKER 1/i$NL$EXTDECLS
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
232 /MARKER 2/i$NL$INITBITS
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
233
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
234 " $config >config.c
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
235 ;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
236 esac
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
237
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
238 case $makepre in
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
239 -) ;;
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
240 *) sedf="@sed.in.$$"
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
241 trap 'rm -f $sedf' 0 1 2 3
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
242 echo "1i\\" >$sedf
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
243 str="# Generated automatically from $makepre by makesetup."
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
244 echo "$str" >>$sedf
2055
cf31eab6ab5a Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents: 1984
diff changeset
245 echo "s%_MODOBJS_%$OBJS%" >>$sedf
cf31eab6ab5a Another bulky set of minor changes.
Guido van Rossum <guido@python.org>
parents: 1984
diff changeset
246 echo "s%_MODLIBS_%$LIBS%" >>$sedf
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
247 echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
248 sed -f $sedf $makepre >Makefile
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
249 cat $rulesf >>Makefile
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
250 rm -f $sedf
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
251 ;;
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1469
diff changeset
252 esac
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
253
1880
05fb9dec2c9c Support shared library creation.
Guido van Rossum <guido@python.org>
parents: 1849
diff changeset
254 rm -f $rulesf
1469
3059218f630b Added some files to new module
Guido van Rossum <guido@python.org>
parents:
diff changeset
255 )