Annotation of embedaddon/miniupnpc/Makefile, revision 1.1.1.2
1.1.1.2 ! misho 1: # $Id: Makefile,v 1.100 2013/01/27 21:48:36 nanard Exp $
1.1 misho 2: # MiniUPnP Project
3: # http://miniupnp.free.fr/
1.1.1.2 ! misho 4: # http://miniupnp.tuxfamily.org/
! 5: # https://github.com/miniupnp/miniupnp
! 6: # (c) 2005-2012 Thomas Bernard
1.1 misho 7: # to install use :
8: # $ PREFIX=/tmp/dummylocation make install
9: # or
10: # $ INSTALLPREFIX=/usr/local make install
1.1.1.2 ! misho 11: # or
1.1 misho 12: # make install (will go to /usr/bin, /usr/lib, etc...)
13: OS = $(shell uname -s)
1.1.1.2 ! misho 14: VERSION = $(shell cat VERSION)
! 15:
! 16: ifeq ($(OS), Darwin)
! 17: JARSUFFIX=mac
! 18: endif
! 19: ifeq ($(OS), Linux)
! 20: JARSUFFIX=linux
! 21: endif
! 22: ifneq (,$(findstring NT-5.1,$(OS)))
! 23: JARSUFFIX=win32
! 24: endif
! 25:
! 26: HAVE_IPV6 ?= yes
! 27: export HAVE_IPV6
! 28:
1.1 misho 29: CC ?= gcc
30: #AR = gar
1.1.1.2 ! misho 31: #CFLAGS = -O -g -DDEBUG
! 32: CFLAGS ?= -O
! 33: CFLAGS += -Wall
! 34: CFLAGS += -W -Wstrict-prototypes
! 35: CFLAGS += -fno-common
! 36: CFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT
! 37: CFLAGS += -DMINIUPNPC_GET_SRC_ADDR
! 38: CFLAGS += -D_BSD_SOURCE -D_POSIX_C_SOURCE=1
! 39: CFLAGS += -ansi
1.1 misho 40: # -DNO_GETADDRINFO
41: INSTALL = install
42: SH = /bin/sh
43: JAVA = java
44: # see http://code.google.com/p/jnaerator/
1.1.1.2 ! misho 45: JNAERATOR = jnaerator-0.9.7.jar
! 46: JNAERATORBASEURL = http://jnaerator.googlecode.com/files/
1.1 misho 47: #following libs are needed on Solaris
48: #LDLIBS=-lsocket -lnsl -lresolv
49:
50: # APIVERSION is used to build SONAME
1.1.1.2 ! misho 51: APIVERSION = 9
1.1 misho 52:
53: SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
54: upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
55: minixmlvalid.c testupnpreplyparse.c minissdpc.c \
56: upnperrors.c testigddescparse.c testminiwget.c \
1.1.1.2 ! misho 57: connecthostport.c portlistingparse.c receivedata.c
1.1 misho 58:
59: LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
60: miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
61: connecthostport.o portlistingparse.o receivedata.o
62:
63: ifneq ($(OS), AmigaOS)
64: CFLAGS := -fPIC $(CFLAGS)
65: LIBOBJS := $(LIBOBJS) minissdpc.o
66: endif
67:
68: OBJS = $(patsubst %.c,%.o,$(SRCS))
69:
70: # HEADERS to install
71: HEADERS = miniupnpc.h miniwget.h upnpcommands.h igd_desc_parse.h \
72: upnpreplyparse.h upnperrors.h miniupnpctypes.h \
73: portlistingparse.h \
74: declspec.h
75:
76: # library names
77: LIBRARY = libminiupnpc.a
78: ifeq ($(OS), Darwin)
79: SHAREDLIBRARY = libminiupnpc.dylib
80: SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib
81: CFLAGS := -DMACOSX -D_DARWIN_C_SOURCE $(CFLAGS)
1.1.1.2 ! misho 82: else
! 83: ifeq ($(OS), Linux)
1.1 misho 84: SHAREDLIBRARY = libminiupnpc.so
85: SONAME = $(SHAREDLIBRARY).$(APIVERSION)
86: endif
1.1.1.2 ! misho 87: ifeq ($(JARSUFFIX), win32)
! 88: SHAREDLIBRARY = miniupnpc.dll
! 89: endif
! 90: endif
1.1 misho 91:
92: EXECUTABLES = upnpc-static
93: EXECUTABLES_ADDTESTS = testminixml minixmlvalid testupnpreplyparse \
94: testigddescparse testminiwget
95:
96: TESTMINIXMLOBJS = minixml.o igd_desc_parse.o testminixml.o
97:
98: TESTMINIWGETOBJS = miniwget.o testminiwget.o connecthostport.o receivedata.o
99:
100: TESTUPNPREPLYPARSE = testupnpreplyparse.o minixml.o upnpreplyparse.o
101:
102: TESTIGDDESCPARSE = testigddescparse.o igd_desc_parse.o minixml.o \
103: miniupnpc.o miniwget.o upnpcommands.o upnpreplyparse.o \
104: minisoap.o connecthostport.o receivedata.o \
105: portlistingparse.o
106:
107: ifneq ($(OS), AmigaOS)
108: EXECUTABLES := $(EXECUTABLES) upnpc-shared
109: TESTMINIWGETOBJS := $(TESTMINIWGETOBJS) minissdpc.o
110: TESTIGDDESCPARSE := $(TESTIGDDESCPARSE) minissdpc.o
111: endif
112:
1.1.1.2 ! misho 113: LIBDIR ?= lib
1.1 misho 114: # install directories
115: INSTALLPREFIX ?= $(PREFIX)/usr
116: INSTALLDIRINC = $(INSTALLPREFIX)/include/miniupnpc
1.1.1.2 ! misho 117: INSTALLDIRLIB = $(INSTALLPREFIX)/$(LIBDIR)
1.1 misho 118: INSTALLDIRBIN = $(INSTALLPREFIX)/bin
1.1.1.2 ! misho 119: INSTALLDIRMAN = $(INSTALLPREFIX)/share/man
1.1 misho 120:
121: FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES)
122: ifneq ($(OS), AmigaOS)
123: FILESTOINSTALL := $(FILESTOINSTALL) $(SHAREDLIBRARY)
124: endif
125:
126:
1.1.1.2 ! misho 127: .PHONY: install clean depend all check test everything \
! 128: installpythonmodule updateversion
1.1 misho 129: # validateminixml validateminiwget
130:
131: all: $(LIBRARY) $(EXECUTABLES)
132:
1.1.1.2 ! misho 133: test: check
! 134:
1.1 misho 135: check: validateminixml validateminiwget
136:
137: everything: all $(EXECUTABLES_ADDTESTS)
138:
139: pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
140: python setup.py build
141: touch $@
142:
143: installpythonmodule: pythonmodule
144: python setup.py install
145:
1.1.1.2 ! misho 146: pythonmodule3: $(LIBRARY) miniupnpcmodule.c setup.py
! 147: python3 setup.py build
! 148: touch $@
! 149:
! 150: installpythonmodule3: pythonmodule3
! 151: python3 setup.py install
! 152:
1.1 misho 153: validateminixml: minixmlvalid
154: @echo "minixml validation test"
155: ./minixmlvalid
156: touch $@
157:
158: validateminiwget: testminiwget minihttptestserver testminiwget.sh
159: @echo "miniwget validation test"
160: ./testminiwget.sh
161: touch $@
162:
163: clean:
164: $(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) miniupnpcstrings.h
165: # clean python stuff
1.1.1.2 ! misho 166: $(RM) pythonmodule pythonmodule3 validateminixml validateminiwget
1.1 misho 167: $(RM) -r build/ dist/
168: #python setup.py clean
1.1.1.2 ! misho 169: # clean jnaerator stuff
! 170: $(RM) _jnaerator.* java/miniupnpc_$(OS).jar
! 171:
! 172: distclean: clean
! 173: $(RM) $(JNAERATOR) java/*.jar java/*.class out.errors.txt
1.1 misho 174:
1.1.1.2 ! misho 175: updateversion: miniupnpc.h
! 176: cp miniupnpc.h miniupnpc.h.bak
! 177: sed 's/\(.*MINIUPNPC_API_VERSION\s\+\)[0-9]\+/\1$(APIVERSION)/' < miniupnpc.h.bak > miniupnpc.h
! 178:
! 179: install: updateversion $(FILESTOINSTALL)
1.1 misho 180: $(INSTALL) -d $(INSTALLDIRINC)
181: $(INSTALL) -m 644 $(HEADERS) $(INSTALLDIRINC)
182: $(INSTALL) -d $(INSTALLDIRLIB)
183: $(INSTALL) -m 644 $(LIBRARY) $(INSTALLDIRLIB)
184: ifneq ($(OS), AmigaOS)
185: $(INSTALL) -m 644 $(SHAREDLIBRARY) $(INSTALLDIRLIB)/$(SONAME)
186: ln -fs $(SONAME) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
187: endif
188: $(INSTALL) -d $(INSTALLDIRBIN)
189: ifeq ($(OS), AmigaOS)
190: $(INSTALL) -m 755 upnpc-static $(INSTALLDIRBIN)/upnpc
191: else
192: $(INSTALL) -m 755 upnpc-shared $(INSTALLDIRBIN)/upnpc
193: endif
194: $(INSTALL) -m 755 external-ip.sh $(INSTALLDIRBIN)/external-ip
1.1.1.2 ! misho 195: ifneq ($(OS), AmigaOS)
! 196: $(INSTALL) -d $(INSTALLDIRMAN)/man3
! 197: $(INSTALL) man3/miniupnpc.3 $(INSTALLDIRMAN)/man3/miniupnpc.3
! 198: endif
! 199:
1.1 misho 200:
201: cleaninstall:
202: $(RM) -r $(INSTALLDIRINC)
203: $(RM) $(INSTALLDIRLIB)/$(LIBRARY)
204: $(RM) $(INSTALLDIRLIB)/$(SHAREDLIBRARY)
205:
206: depend:
207: makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null
208:
209: $(LIBRARY): $(LIBOBJS)
210: $(AR) crs $@ $?
211:
212: $(SHAREDLIBRARY): $(LIBOBJS)
213: ifeq ($(OS), Darwin)
1.1.1.2 ! misho 214: # $(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(SONAME) -o $@ $^
! 215: $(CC) -dynamiclib $(LDFLAGS) -Wl,-install_name,$(INSTALLDIRLIB)/$(SONAME) -o $@ $^
1.1 misho 216: else
217: $(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^
218: endif
219:
220: upnpc-static: upnpc.o $(LIBRARY) $(LDLIBS)
221: $(CC) $(LDFLAGS) -o $@ $^
222:
223: upnpc-shared: upnpc.o $(SHAREDLIBRARY) $(LDLIBS)
224: $(CC) $(LDFLAGS) -o $@ $^
225:
226: testminixml: $(TESTMINIXMLOBJS)
227:
228: testminiwget: $(TESTMINIWGETOBJS)
229:
230: minixmlvalid: minixml.o minixmlvalid.o
231:
232: testupnpreplyparse: $(TESTUPNPREPLYPARSE)
233:
234: testigddescparse: $(TESTIGDDESCPARSE)
235:
1.1.1.2 ! misho 236: miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
1.1 misho 237: $(SH) updateminiupnpcstrings.sh
238:
1.1.1.2 ! misho 239: jnaerator-0.9.8-shaded.jar:
! 240: wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
! 241:
! 242: jnaerator-0.9.7.jar:
! 243: wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
! 244:
! 245: jnaerator-0.9.3.jar:
! 246: wget $(JNAERATORBASEURL)/$@ || curl -o $@ $(JNAERATORBASEURL)/$@
! 247:
! 248: jar: $(SHAREDLIBRARY) $(JNAERATOR)
! 249: $(JAVA) -jar $(JNAERATOR) -library miniupnpc \
! 250: miniupnpc.h declspec.h upnpcommands.h upnpreplyparse.h \
! 251: igd_desc_parse.h miniwget.h upnperrors.h $(SHAREDLIBRARY) \
! 252: -package fr.free.miniupnp -o . -jar java/miniupnpc_$(JARSUFFIX).jar -v
! 253:
! 254: mvn_install:
! 255: mvn install:install-file -Dfile=java/miniupnpc_$(JARSUFFIX).jar \
! 256: -DgroupId=com.github \
! 257: -DartifactId=miniupnp \
! 258: -Dversion=$(VERSION) \
! 259: -Dpackaging=jar \
! 260: -Dclassifier=$(JARSUFFIX) \
! 261: -DgeneratePom=true \
! 262: -DcreateChecksum=true
! 263:
! 264: # make .deb packages
! 265: deb: /usr/share/pyshared/stdeb all
! 266: (python setup.py --command-packages=stdeb.command bdist_deb)
! 267:
! 268: # install .deb packages
! 269: ideb:
! 270: (sudo dpkg -i deb_dist/*.deb)
! 271:
! 272: /usr/share/pyshared/stdeb: /usr/share/doc/python-all-dev
! 273: (sudo apt-get install python-stdeb)
! 274:
! 275: /usr/share/doc/python-all-dev:
! 276: (sudo apt-get install python-all-dev)
1.1 misho 277:
278: minihttptestserver: minihttptestserver.o
279:
280: # DO NOT DELETE THIS LINE -- make depend depends on it.
281:
282: igd_desc_parse.o: igd_desc_parse.h
283: miniupnpc.o: miniupnpc.h declspec.h igd_desc_parse.h minissdpc.h miniwget.h
284: miniupnpc.o: minisoap.h minixml.h upnpcommands.h upnpreplyparse.h
285: miniupnpc.o: portlistingparse.h miniupnpctypes.h connecthostport.h
286: miniupnpc.o: receivedata.h
287: minixml.o: minixml.h
288: minisoap.o: minisoap.h miniupnpcstrings.h
289: miniwget.o: miniupnpcstrings.h miniwget.h declspec.h connecthostport.h
290: miniwget.o: receivedata.h
291: upnpc.o: miniwget.h declspec.h miniupnpc.h igd_desc_parse.h upnpcommands.h
292: upnpc.o: upnpreplyparse.h portlistingparse.h miniupnpctypes.h upnperrors.h
293: upnpcommands.o: upnpcommands.h upnpreplyparse.h portlistingparse.h declspec.h
294: upnpcommands.o: miniupnpctypes.h miniupnpc.h igd_desc_parse.h
295: upnpreplyparse.o: upnpreplyparse.h minixml.h
296: testminixml.o: minixml.h igd_desc_parse.h
297: minixmlvalid.o: minixml.h
298: testupnpreplyparse.o: upnpreplyparse.h
299: minissdpc.o: minissdpc.h miniupnpc.h declspec.h igd_desc_parse.h codelength.h
300: upnperrors.o: upnperrors.h declspec.h upnpcommands.h upnpreplyparse.h
301: upnperrors.o: portlistingparse.h miniupnpctypes.h miniupnpc.h
302: upnperrors.o: igd_desc_parse.h
303: testigddescparse.o: igd_desc_parse.h minixml.h miniupnpc.h declspec.h
304: testminiwget.o: miniwget.h declspec.h
305: connecthostport.o: connecthostport.h
306: receivedata.o: receivedata.h
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>