summaryrefslogtreecommitdiffstats
path: root/Modules/makesetup
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-01-02 00:26:09 (GMT)
committerGuido van Rossum <guido@python.org>1994-01-02 00:26:09 (GMT)
commitfba715ab6c851e9769480788e218b2992ed992d7 (patch)
tree63f6a787e25b8f0a8106806510ac1792e35c2c21 /Modules/makesetup
parentf30adc8a993209797d39f8ceb18416e6a165da60 (diff)
downloadcpython-fba715ab6c851e9769480788e218b2992ed992d7.zip
cpython-fba715ab6c851e9769480788e218b2992ed992d7.tar.gz
cpython-fba715ab6c851e9769480788e218b2992ed992d7.tar.bz2
Added some files to new module
Diffstat (limited to 'Modules/makesetup')
-rwxr-xr-xModules/makesetup71
1 files changed, 71 insertions, 0 deletions
diff --git a/Modules/makesetup b/Modules/makesetup
new file mode 100755
index 0000000..b5cc57b
--- /dev/null
+++ b/Modules/makesetup
@@ -0,0 +1,71 @@
+#! /bin/sh
+
+# This script converts Makefile.in.in and config.c.in into Makefile.in
+# and config.c, based on the module definitions found in the file
+# Setup.
+
+NL="\\
+"
+
+sed -e 's/#.*//' -e '/^[ ]*$/d' ${1-Setup} |
+(
+ DEFS=
+ MODS=
+ OBJS=
+ LIBS=
+ RULES=
+
+ while read line
+ do
+ case $line in
+ *=*) DEFS="$DEFS$line$NL"; continue;;
+ esac
+ objs=
+ cpps=
+ set $line
+ for arg
+ do
+ case $arg in
+ -[IDUC]*) cpps="$cpps $arg";;
+ -[Ll]*) LIBS="$LIBS $arg";;
+ *.a) LIBS="$LIBS $arg";;
+ *.o) objs="$objs $arg";;
+ *.*) echo 1>&2 "bad word $arg in $line"
+ exit 1;;
+ [a-zA-Z_]*) MODS="$MODS $arg";;
+ *) echo 1>&2 "bad word $arg in $line"
+ exit 1;;
+ esac
+ done
+ for obj in $objs
+ do
+ src=`basename $obj .o`.c
+ RULES="$RULES$obj: $src; \$(CC) \$(CFLAGS) $cpps -c $src$NL"
+ done
+ OBJS="$OBJS $objs"
+ done
+
+ EXTDECLS=
+ INITBITS=
+ for mod in $MODS
+ do
+ EXTDECLS="${EXTDECLS}extern void init$mod();$NL"
+ INITBITS="${INITBITS} {\"$mod\", init$mod},$NL"
+ done
+ sed -e "
+ /MARKER 1/i$NL$EXTDECLS
+
+ /MARKER 2/i$NL$INITBITS
+
+ " config.c.in >config.c
+
+ sed -e "
+ s%@MODOBJS@%$OBJS%
+ s%@MODLIBS@%$LIBS%
+ /Rules added by ..makesetup/a$NL$NL$RULES
+
+ /Definitions added by ..makesetup/a$NL$NL$DEFS
+
+ " Makefile.in.in >Makefile.in
+
+)