Fix pythonmodule build to work with other MAKE commands

This commit is contained in:
Thomas Bernard 2018-02-03 23:52:57 +01:00
parent 14f1225ef6
commit 8fc2438474
2 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.19 2012/08/21 17:24:07 nanard Exp $
# This Makefile is designed for use with GNU make
# libnatpmp
# (c) 2007-2015 Thomas Bernard
# (c) 2007-2018 Thomas Bernard
# http://miniupnp.free.fr/libnatpmp.html
OS = $(shell uname -s)
@ -85,11 +85,11 @@ JNIHEADERS = fr_free_miniupnp_libnatpmp_NatPmp.h
all: $(STATICLIB) $(SHAREDLIB) $(EXECUTABLES)
pythonmodule: $(STATICLIB) libnatpmpmodule.c setup.py
python setup.py build
MAKE=$(MAKE) python setup.py build
touch $@
installpythonmodule: pythonmodule
python setup.py install
MAKE=$(MAKE) python setup.py install
clean:
$(RM) $(OBJS) $(EXECUTABLES) $(STATICLIB) $(SHAREDLIB) $(JAVACLASSES) $(JNISHAREDLIB)

View File

@ -1,4 +1,5 @@
#! /usr/bin/python
# vim: tabstop=8 shiftwidth=8 expandtab
# $Id: setup.py,v 1.3 2012/03/05 04:54:01 nanard Exp $
#
# python script to build the libnatpmp module under unix
@ -6,15 +7,21 @@
from setuptools import setup, Extension
from setuptools.command import build_ext
import subprocess
import os
EXT = ['libnatpmp.a']
class make_then_build_ext(build_ext.build_ext):
def run(self):
subprocess.check_call(['make'] + EXT)
subprocess.check_call([os.environ.get('MAKE','make')] + EXT)
build_ext.build_ext.run(self)
setup(name="libnatpmp", version="1.0",
setup(name="libnatpmp",
version="1.0",
author='Thomas BERNARD',
author_email='miniupnp@free.fr',
license=open('LICENSE').read(),
description='NAT-PMP library',
cmdclass={'build_ext': make_then_build_ext},
ext_modules=[
Extension(name="libnatpmp", sources=["libnatpmpmodule.c"],