summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/LibNATPMP/src/libnatpmp/Makefile')
-rw-r--r--3rdParty/LibNATPMP/src/libnatpmp/Makefile97
1 files changed, 97 insertions, 0 deletions
diff --git a/3rdParty/LibNATPMP/src/libnatpmp/Makefile b/3rdParty/LibNATPMP/src/libnatpmp/Makefile
new file mode 100644
index 0000000..b523e53
--- /dev/null
+++ b/3rdParty/LibNATPMP/src/libnatpmp/Makefile
@@ -0,0 +1,97 @@
+# $Id: Makefile,v 1.16 2011/01/03 17:31:03 nanard Exp $
+# This Makefile is designed for use with GNU make
+# libnatpmp
+# (c) 2007-2011 Thomas Bernard
+# http://miniupnp.free.fr/libnatpmp.html
+
+OS = $(shell uname -s)
+CC = gcc
+INSTALL = install
+
+# APIVERSION is used in soname
+APIVERSION = 1
+LDFLAGS = --no-undefined
+CFLAGS = -O -fPIC -Wall -DENABLE_STRNATPMPERR
+
+LIBOBJS = natpmp.o getgateway.o
+
+OBJS = $(LIBOBJS) testgetgateway.o natpmpc.o
+
+STATICLIB = libnatpmp.a
+ifeq ($(OS), Darwin)
+ SHAREDLIB = libnatpmp.dynlib
+ SONAME = $(basename $(SHAREDLIB)).$(APIVERSION).dylib
+ CFLAGS := -DMACOSX -D_DARWIN_C_SOURCE $(CFLAGS)
+else
+ SHAREDLIB = libnatpmp.so
+ SONAME = $(SHAREDLIB).$(APIVERSION)
+endif
+
+HEADERS = natpmp.h
+
+EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static
+
+INSTALLPREFIX ?= $(PREFIX)/usr
+INSTALLDIRINC = $(INSTALLPREFIX)/include
+INSTALLDIRLIB = $(INSTALLPREFIX)/lib
+INSTALLDIRBIN = $(INSTALLPREFIX)/bin
+
+.PHONY: all clean depend install cleaninstall installpythonmodule
+
+all: $(STATICLIB) $(SHAREDLIB) $(EXECUTABLES)
+
+pythonmodule: $(STATICLIB) libnatpmpmodule.c setup.py
+ python setup.py build
+ touch $@
+
+installpythonmodule: pythonmodule
+ python setup.py install
+
+clean:
+ $(RM) $(OBJS) $(EXECUTABLES) $(STATICLIB) $(SHAREDLIB)
+ $(RM) pythonmodule
+ $(RM) -r build/ dist/
+
+depend:
+ makedepend -f$(MAKEFILE_LIST) -Y $(OBJS:.o=.c) 2>/dev/null
+
+install: $(HEADERS) $(STATICLIB) $(SHAREDLIB) natpmpc-shared
+ $(INSTALL) -d $(INSTALLDIRINC)
+ $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
+ $(INSTALL) -d $(INSTALLDIRLIB)
+ $(INSTALL) -m 644 $(STATICLIB) $(INSTALLDIRLIB)
+ $(INSTALL) -m 644 $(SHAREDLIB) $(INSTALLDIRLIB)/$(SONAME)
+ $(INSTALL) -d $(INSTALLDIRBIN)
+ $(INSTALL) -m 755 natpmpc-shared $(INSTALLDIRBIN)/natpmpc
+ ln -s -f $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIB)
+
+cleaninstall:
+ $(RM) $(addprefix $(INSTALLDIRINC), $(HEADERS))
+ $(RM) $(INSTALLDIRLIB)/$(SONAME)
+ $(RM) $(INSTALLDIRLIB)/$(SHAREDLIB)
+ $(RM) $(INSTALLDIRLIB)/$(STATICLIB)
+
+testgetgateway: testgetgateway.o getgateway.o
+
+natpmpc-static: natpmpc.o $(STATICLIB)
+ $(CC) -o $@ $^
+
+natpmpc-shared: natpmpc.o $(SHAREDLIB)
+ $(CC) -o $@ $^
+
+$(STATICLIB): $(LIBOBJS)
+ $(AR) crs $@ $?
+
+$(SHAREDLIB): $(LIBOBJS)
+ifeq ($(OS), Darwin)
+ $(CC) -dynamiclib -Wl,-install_name,$(SONAME) -o $@ $^
+else
+ $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
+endif
+
+# DO NOT DELETE
+
+natpmp.o: natpmp.h getgateway.h declspec.h
+getgateway.o: getgateway.h declspec.h
+testgetgateway.o: getgateway.h declspec.h
+natpmpc.o: natpmp.h