
# Leave the blank line at the top of the file to ensure separation
# from preceeding contents of the stock Makefile.pre.in.


MYPACKAGE=krb5module
MYVERSION=0.1
PYTHONMODS=ksocket.py

TARBALL=$(MYPACKAGE)-$(MYVERSION).tar.gz
DESTSCRIPT=$(LIBDEST)/site-packages
CMD=import sys; print sys.exec_prefix + '/lib/python' + sys.version[:3]


initialize:	Makefile.pre.in
	$(MAKE) -f $< boot
	$(MAKE)

Makefile.boot:
	cp Makefile $@

Makefile.pre.in: Makefile.boot
	LIBPL=`python -c "$(CMD)"`/config ; \
	cp $$LIBPL/$@ $@ && \
		cat Makefile.boot >>$@

clean:		my-clean
distclean:	my-distclean
install:	my-install

my-clean:
	rm -f *.pyc *.pyo

my-distclean:
	rm -f Makefile.pre.in $(TARBALL)

my-install:
	if test ! -d $(DESTSCRIPT) ; then \
	    mkdir $(DESTSCRIPT) ; else true ; fi
	-for i in $(PYTHONMODS); do \
	    (set -x; $(INSTALL) $$i $(DESTSCRIPT)/$$i; \
	     python -c "import py_compile; py_compile.compile('$(DESTSCRIPT)/$$i')"; \
	     python -Oc "import py_compile; py_compile.compile('$(DESTSCRIPT)/$$i')" \
	    ) ; done

uninstall:
	LIBPL=`python -c "$(CMD)"`/config ; \
	-for i in $(PYTHONMODS); do \
		(set -x; rm -f $(DESTSCRIPT)/$$i*); done
	-for i in X $(SHAREDMODS); do \
		if test $$i != X; then \
			(set -x; rm -f $(DESTSHARED)/$$i); \
		fi; \
	done

tarball:	$(TARBALL)

# adding Makefile.boot as a dependency here allows building the tarball
# without running through the "boot" process using Makefile.pre.in.

$(TARBALL):	Makefile.boot distclean
	mv Makefile.boot Makefile
	tar cf - -C .. $(MYPACKAGE) | gzip >/usr/tmp/tarball-$$$$ && \
		mv /usr/tmp/tarball-$$$$ $@
