miniupnp/miniupnpc/Makefile.mingw

122 lines
3.3 KiB
Makefile
Raw Permalink Normal View History

# $Id: Makefile.mingw,v 1.21 2015/09/18 12:45:16 nanard Exp $
2011-09-27 20:25:35 +00:00
# Miniupnp project.
# 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
#
# To cross compile on a *nix machine :
# make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar
#
CC ?= gcc
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 \
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:
$(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)
$(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
# echo $@ generated with $<
2011-09-27 20:25:35 +00:00
dll/upnpc.o: upnpc.o
# echo $@ generated with $<
2011-09-27 20:25:35 +00:00
.c.o:
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
2011-09-27 20:25:35 +00:00
$(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o dll/$@ $<
upnpc.o: upnpc.c
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
2011-09-27 20:25:35 +00:00
$(CC) $(CFLAGS) -c -o dll/$@ $<
# --enable-stdcall-fixup
2011-09-27 20:25:35 +00:00
upnpc-static: upnpc.o libminiupnpc.a
$(CC) -o $@ $^ $(LDLIBS)
2011-09-27 20:25:35 +00:00
upnpc-shared: dll/upnpc.o miniupnpc.lib
$(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
# 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 $< $@
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
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
minissdpc.o: minissdpc.c minissdpc.h receivedata.h
upnpdev.o: upnpdev.c upnpdev.h