Source

cpython-withatomic / Modules / makesetup

The branch 'legacy-trunk' does not exist.
#! /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

)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.