2015-09-18 16:11:56 +00:00
|
|
|
# $Id: Makefile.mingw,v 1.21 2015/09/18 12:45:16 nanard Exp $
|
2011-09-27 20:25:35 +00:00
|
|
|
# Miniupnp project.
|
2018-04-26 20:13:06 +00:00
|
|
|
# http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
|
|
|
|
# (c) 2005-2018 Thomas Bernard
|
2011-09-27 20:25:35 +00:00
|
|
|
# This Makefile is made for MinGW
|
|
|
|
#
|
2018-04-26 20:13:06 +00:00
|
|
|
# To cross compile on a *nix machine :
|
|
|
|
# make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar
|
|
|
|
#
|
2015-10-26 10:04:47 +00:00
|
|
|
CC ?= gcc
|
2018-04-26 20:13:06 +00:00
|
|
|
DLLWRAP = dllwrap
|
|
|
|
SH = /bin/sh
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
RM = del
|
|
|
|
else
|
|
|
|
RM = rm -f
|
|
|
|
endif
|
2011-09-27 20:25:35 +00:00
|
|
|
#CFLAGS = -Wall -g -DDEBUG -D_WIN32_WINNT=0X501
|
|
|
|
CFLAGS = -Wall -Os -DNDEBUG -D_WIN32_WINNT=0X501
|
|
|
|
LDLIBS = -lws2_32 -liphlpapi
|
|
|
|
# -lwsock32
|
2013-02-06 13:57:49 +00:00
|
|
|
# -liphlpapi is needed for GetBestRoute() and GetIpAddrTable()
|
2011-09-27 20:25:35 +00:00
|
|
|
PYTHON=\utils\python25\python
|
|
|
|
OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \
|
2015-09-15 22:12:43 +00:00
|
|
|
minissdpc.o \
|
2011-09-27 20:25:35 +00:00
|
|
|
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
|
2015-09-15 22:08:52 +00:00
|
|
|
connecthostport.o portlistingparse.o receivedata.o \
|
2015-09-15 22:12:43 +00:00
|
|
|
upnpdev.o
|
2011-09-27 20:25:35 +00:00
|
|
|
OBJSDLL=$(addprefix dll/, $(OBJS))
|
|
|
|
|
2016-01-17 18:33:13 +00:00
|
|
|
all: init upnpc-static upnpc-shared testminixml libminiupnpc.a \
|
|
|
|
miniupnpc.dll listdevices
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
init:
|
|
|
|
mkdir dll
|
|
|
|
echo init > init
|
|
|
|
|
|
|
|
clean:
|
2018-04-26 20:13:06 +00:00
|
|
|
$(RM) upnpc testminixml *.o
|
|
|
|
$(RM) dll\*.o
|
|
|
|
$(RM) *.exe
|
|
|
|
$(RM) miniupnpc.dll
|
|
|
|
$(RM) libminiupnpc.a
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
libminiupnpc.a: $(OBJS)
|
|
|
|
$(AR) cr $@ $?
|
|
|
|
|
|
|
|
pythonmodule: libminiupnpc.a
|
|
|
|
$(PYTHON) setupmingw32.py build --compiler=mingw32
|
|
|
|
$(PYTHON) setupmingw32.py install --skip-build
|
|
|
|
|
|
|
|
miniupnpc.dll: libminiupnpc.a $(OBJSDLL)
|
2018-04-26 20:13:06 +00:00
|
|
|
$(DLLWRAP) -k --driver-name $(CC) \
|
2011-09-27 20:25:35 +00:00
|
|
|
--def miniupnpc.def \
|
|
|
|
--output-def miniupnpc.dll.def \
|
|
|
|
--implib miniupnpc.lib -o $@ \
|
|
|
|
$(OBJSDLL) $(LDLIBS)
|
|
|
|
|
|
|
|
miniupnpc.lib: miniupnpc.dll
|
2015-10-26 09:48:45 +00:00
|
|
|
# echo $@ generated with $<
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
dll/upnpc.o: upnpc.o
|
2015-10-26 09:48:45 +00:00
|
|
|
# echo $@ generated with $<
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
.c.o:
|
2014-06-01 10:22:35 +00:00
|
|
|
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
|
2011-09-27 20:25:35 +00:00
|
|
|
$(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o dll/$@ $<
|
|
|
|
|
2015-10-26 10:04:47 +00:00
|
|
|
upnpc.o: upnpc.c
|
2014-06-01 10:22:35 +00:00
|
|
|
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
|
2011-09-27 20:25:35 +00:00
|
|
|
$(CC) $(CFLAGS) -c -o dll/$@ $<
|
|
|
|
|
2014-01-27 15:28:50 +00:00
|
|
|
# --enable-stdcall-fixup
|
2011-09-27 20:25:35 +00:00
|
|
|
upnpc-static: upnpc.o libminiupnpc.a
|
2014-01-27 15:28:50 +00:00
|
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
upnpc-shared: dll/upnpc.o miniupnpc.lib
|
2014-01-27 15:28:50 +00:00
|
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
2011-09-27 20:25:35 +00:00
|
|
|
|
2016-01-17 18:33:13 +00:00
|
|
|
listdevices: listdevices.o libminiupnpc.a
|
|
|
|
$(CC) -o $@ $^ $(LDLIBS)
|
|
|
|
|
2011-09-27 20:25:35 +00:00
|
|
|
wingenminiupnpcstrings: wingenminiupnpcstrings.o
|
|
|
|
|
|
|
|
wingenminiupnpcstrings.o: wingenminiupnpcstrings.c
|
|
|
|
|
2018-04-26 20:13:06 +00:00
|
|
|
# To make miniupnpcstrings.h from miniupnpcstrings.h.in we either
|
|
|
|
# use a custom executable (if running make under windows) or use
|
|
|
|
# sed (if cross compiling from another platform).
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2011-09-27 20:25:35 +00:00
|
|
|
miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings
|
|
|
|
wingenminiupnpcstrings $< $@
|
2018-04-26 20:13:06 +00:00
|
|
|
else
|
|
|
|
miniupnpcstrings.h: miniupnpcstrings.h.in VERSION
|
|
|
|
sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \
|
|
|
|
sed 's|MINIUPNPC_VERSION_STRING ".*"|MINIUPNPC_VERSION_STRING "$(shell cat VERSION)"|' > $@
|
|
|
|
endif
|
2011-09-27 20:25:35 +00:00
|
|
|
|
2015-09-15 22:01:54 +00:00
|
|
|
minixml.o: minixml.c minixml.h
|
2011-09-27 20:25:35 +00:00
|
|
|
|
2015-10-26 10:04:47 +00:00
|
|
|
upnpc.o: miniwget.h minisoap.h miniupnpc.h igd_desc_parse.h
|
2015-09-15 22:01:54 +00:00
|
|
|
upnpc.o: upnpreplyparse.h upnpcommands.h upnperrors.h miniupnpcstrings.h
|
2011-09-27 20:25:35 +00:00
|
|
|
|
|
|
|
miniwget.o: miniwget.c miniwget.h miniupnpcstrings.h connecthostport.h
|
|
|
|
|
|
|
|
minisoap.o: minisoap.c minisoap.h miniupnpcstrings.h
|
|
|
|
|
|
|
|
miniupnpc.o: miniupnpc.c miniupnpc.h minisoap.h miniwget.h minixml.h
|
|
|
|
|
|
|
|
igd_desc_parse.o: igd_desc_parse.c igd_desc_parse.h
|
|
|
|
|
|
|
|
testminixml: minixml.o igd_desc_parse.o testminixml.c
|
|
|
|
|
|
|
|
upnpreplyparse.o: upnpreplyparse.c upnpreplyparse.h minixml.h
|
|
|
|
|
|
|
|
upnpcommands.o: upnpcommands.c upnpcommands.h upnpreplyparse.h miniupnpc.h portlistingparse.h
|
|
|
|
|
2015-09-18 16:11:56 +00:00
|
|
|
minissdpc.o: minissdpc.c minissdpc.h receivedata.h
|
2015-09-15 22:08:52 +00:00
|
|
|
|
|
|
|
upnpdev.o: upnpdev.c upnpdev.h
|
|
|
|
|