# Generated automatically from Makefile.pre by makesetup.
# Generated automatically from Makefile.pre.in by sedscript.
# Universal Makefile to build Python extensions.
#
# Instructions:
#
# 0) Build and install the basic Python 1.4 distribution.  You must
# also install the headers ("make inclinstall") and the binary library
# files ("make libainstall").
#
# 1) Edit Makefile.pre.in (not any other file!!!) to change the
# definition of installdir (and possibly exec_installdir).  These
# should match the prefix and exec_prefix used when installing Python.
# Alternatively, you can specify a value for installdir on the
# "make -f Makefile.pre.in Makefile" command line (see below).  This
# is probably easier since it avoids editing Makefile.pre.in at all...
#
# 2) Copy Setup.in to Setup and edit Setup to change the selection of
# modules you want to use.  Read the comments in the core Python's
# Modules/Setup.in for more detailed instructions.
#
# 3) Run "make Makefile -f Makefile.pre.in".  This creates Makefile
# (producing Makefile.pre and sedscript as intermediate files) and
# config.c.  Values for installdir, srcdir, VPATH, LINKPATH, OPT,
# BASELIB and BASESETUP on the make command line will be incorporated
# in the final Makefile.
#
# 4) Run "make".  This creates a Python executable.  The set of
# built-in modules and features is a superset of that of the basic
# Python -- additions are taken from ./Setup.
#
# If you don't actually want to install the Python headers and
# binary library files, you can edit the "Fixed definitions" section
# below to point directly into the source and/or build tree.
#
# Note: Each time you edit Makefile.pre.in or Setup, you must run
# "make Makefile" before running "make".
#
# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and say (e.g.):
# make -f ../Makefile.pre.in srcdir=.. VPATH=.. Makefile


# === Variables that you just *have* to customize manually ===

# (You can also specify their values on the command line for
# "make -f Makefile.pre.in Makefile".)

# The prefix used by "make inclinstall libainstall" of core python
installdir=	/usr/local

# The exec_prefix used by the same
exec_installdir=/usr/local

# Source directory and VPATH in case you want to use VPATH.
# (You will have to edit these two lines yourself -- there is no
# automatic support as the Makefile is not generated by
# config.status.)
srcdir=		.
VPATH=		.

# === Variables that you may want to customize ===

# Add possible -L options here
LINKPATH=	

# You may want to change this to -O
OPT=		-O

# Add more -I and -D options here
CFLAGS=		$(OPT) -I$(INCLUDEPY) -I$(LIBPL) $(DEFS) -Wall

# These two variables can be set in Setup to merge extensions.
# See example[23].
BASELIB=	
BASESETUP=	

# === Variables set by makesetup ===

MODOBJS=	
MODLIBS=	$(LOCALMODLIBS) $(BASEMODLIBS)

# === Definitions added by makesetup ===

LOCALMODLIBS=
BASEMODLIBS=   
SHAREDMODS= SSLeay$(SO)
PYTHONPATH=$(COREPYTHONPATH)
COREPYTHONPATH=.$(SITEPATH)$(DESTPATH)$(TESTPATH)$(MACHDEPPATH)$(STDWINPATH)$(TKPATH)
MACHDEPPATH=:$(DESTLIB)/$(MACHDEP)
TESTPATH=:$(DESTLIB)/test
DESTPATH=:$(DESTLIB)
SITEPATH=
DESTLIB=$(prefix)/lib/python


# === Variables from configure (through sedscript) ===

DEFS=		-DHAVE_CONFIG_H
LIBS=		-lieee -ldl 
LIBM=		-lm
LIBC=		
RANLIB=		ranlib
MACHDEP=	linux1
SO=		.so
LDSHARED=	gcc-elf -shared
CCSHARED=	-fpic
LINKFORSHARED=	-rdynamic

CC=		gcc -I/usr/local/include
SYSLIBS=	-L/usr/local/lib $(LIBM) $(LIBC) 

# Values for compilation at CS&T; ignore these.
##CC=	$(COMPILER) -I/develop/M/cur/inc -Wl,-E \
##	$(ANSI) $(STANDARD) $(OSTYPE) $(MACHINE) 
##SYSLIBS = -L/develop/M/cur/lib/$(OBJDIR) -ldxgen -ldxuniapi \
##        -ldxgen -ldxtrn -ldxmisc -ldxgen $(SOKLIB) $(LIBM) $(LIBC)

# Install prefix for architecture-independent files
prefix=		/usr/local

# Install prefix for architecture-dependent files
exec_prefix=	${prefix}

# === Fixed definitions ===

INCLUDEPY=	$(installdir)/include/Py
LIBP=		$(exec_installdir)/lib/python
LIBPL=		$(LIBP)/lib

PYTHONLIBS=	$(LIBPL)/libModules.a \
		$(LIBPL)/libPython.a \
		$(LIBPL)/libObjects.a \
		$(LIBPL)/libParser.a

MAKESETUP=	$(LIBPL)/makesetup
MAKEFILE=	$(LIBPL)/Makefile
CONFIGC=	$(LIBPL)/config.c
CONFIGCIN=	$(LIBPL)/config.c.in
SETUP=		$(LIBPL)/Setup


# === Fixed rules ===

all:		sharedmods

sharedmods:	$(SHAREDMODS)

python:		config.o lib.a $(PYTHONLIBS) Makefile
		$(CC) config.o lib.a $(PYTHONLIBS) \
		 $(LINKPATH) $(BASELIB) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python

lib.a:		$(MODOBJS)
		-rm -f lib.a
		ar cr lib.a $(MODOBJS)
		-$(RANLIB) lib.a || \
		echo "don't worry if ranlib fails -- probably SYSV or equiv"

# This runs makesetup *twice* to use the BASESETUP definition from Setup
config.c Makefile:	Makefile.pre Setup $(BASESETUP) $(MAKESETUP)
		$(MAKESETUP) \
		 -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)
		$(MAKE) -f Makefile do-it-again

do-it-again:
		$(MAKESETUP) \
		 -m Makefile.pre -c $(CONFIGCIN) Setup -n $(BASESETUP) $(SETUP)

config.o:	config.c Makefile
		$(CC) $(CFLAGS) -DPYTHONPATH=\"$(PYTHONPATH)\" -c config.c

# Setup is copied from Setup.in *only* if it doesn't yet exist
Setup:
		cp $(srcdir)/Setup.in Setup

Makefile.pre: Makefile.pre.in sedscript
		sed -f sedscript $(srcdir)/Makefile.pre.in >Makefile.pre

# Shortcuts to make the sed arguments on one line
P=prefix
E=exec_prefix
H=Generated automatically from Makefile.pre.in by sedscript.
sedscript:	$(MAKEFILE)
		sed -n \
		  -e '1s/.*/1i\\/p' \
		  -e '2s%.*%# $H%p' \
		  -e '/^CC=/s/^CC=[ 	]*\(.*\)/s%@CC[@]%\1%/p' \
		  -e '/^DEFS=/s/^DEFS=[ 	]*\(.*\)/s%@DEFS[@]%\1%/p' \
		  -e '/^LIBS=/s/^LIBS=[ 	]*\(.*\)/s%@LIBS[@]%\1%/p' \
		  -e '/^LIBM=/s/^LIBM=[ 	]*\(.*\)/s%@LIBM[@]%\1%/p' \
		  -e '/^LIBC=/s/^LIBC=[ 	]*\(.*\)/s%@LIBC[@]%\1%/p' \
		  -e '/^RANLIB=/s/^RANLIB=[ 	]*\(.*\)/s%@RANLIB[@]%\1%/p' \
		  -e '/^MACHDEP=/s/^MACHDEP=[ 	]*\(.*\)/s%@MACHDEP[@]%\1%/p' \
		  -e '/^SO=/s/^SO=[ 	]*\(.*\)/s%@SO[@]%\1%/p' \
		  -e '/^LDSHARED=/s/^LDSHARED=[ 	]*\(.*\)/s%@LDSHARED[@]%\1%/p' \
		  -e '/^CCSHARED=/s/^CCSHARED=[ 	]*\(.*\)/s%@CCSHARED[@]%\1%/p' \
		  -e '/^LINKFORSHARED=/s/^LINKFORSHARED=[ 	]*\(.*\)/s%@LINKFORSHARED[@]%\1%/p' \
		  -e '/^$P=/s/^$P=\(.*\)/s%^$P=.*%$P=\1%/p' \
		  -e '/^$E=/s/^$E=\(.*\)/s%^$E=.*%$E=\1%/p' \
		  $(MAKEFILE) >sedscript
		( \
		  echo "/^installdir=/s%=.*%=	$(installdir)%"; \
		  echo "/^exec_installdir=/s%=.*%=$(exec_installdir)%"; \
		  echo "/^srcdir=/s%=.*%=		$(srcdir)%"; \
		  echo "/^VPATH=/s%=.*%=		$(VPATH)%"; \
		  echo "/^LINKPATH=/s%=.*%=	$(LINKPATH)%"; \
		  echo "/^OPT=/s%=.*%=		$(OPT)%"; \
		  echo "/^BASELIB=/s%=.*%=	$(BASELIB)%"; \
		  echo "/^BASESETUP=/s%=.*%=	$(BASESETUP)%"; \
		) >>sedscript

clean:
		-rm -f `find . -name '*.o' -o -name '*~'`
		-rm -f `find . -name '*.pyc' -o -name '*.log'`
		-rm -f *.so err out

clobber:	clean
		-rm -f python lib.a sedscript config.c Makefile.pre

distclean:	clobber
		-rm -f Setup

dist: distclean
	texi2html.py ssleay.texi html
	cd .. ; tar -zcvf /scratch/ssleay.tgz -X SSLeay/excludefiles SSLeay
	
SSLeay.o : SSLeay_impl.i SSLeay_tail.i SSLCTX_impl.i SSLCTX_tail.i SSLeay.c
SSLeay.o : SSLconn_impl.i SSLconn_tail.i X509_impl.i X509_tail.i

SSLeay.c : framework.py
	python framework.py

# Rules appended by makedepend

SSLeay.o: $(srcdir)/SSLeay.c; $(CC) $(CCSHARED) $(CFLAGS)  -I/usr/local/ssl/include -c $(srcdir)/SSLeay.c
SSLeay$(SO):  SSLeay.o; $(LDSHARED)  SSLeay.o  -lssl -lcrypto -o SSLeay$(SO)
