Annotation of embedaddon/miniupnpc/Makefile.mingw, revision 1.1.1.3
1.1.1.3 ! misho 1: # $Id: Makefile.mingw,v 1.35 2022/10/16 05:28:15 nanard Exp $
1.1 misho 2: # Miniupnp project.
1.1.1.3 ! misho 3: # http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
! 4: # (c) 2005-2020 Thomas Bernard
1.1 misho 5: # This Makefile is made for MinGW
6: #
1.1.1.3 ! misho 7: # To cross compile on a *nix machine :
! 8: # make -f Makefile.mingw DLLWRAP=mingw32-dllwrap CC=mingw32-gcc AR=mingw32-ar WINDRES=mingw32-windres
! 9: #
! 10: SRCDIR = src
! 11: INCDIR = include
! 12:
! 13: CC ?= gcc
! 14: SETUP_COMPILER_FLAG?=
! 15: DLLWRAP = dllwrap
! 16: WINDRES = windres
! 17: SH = /bin/sh
! 18: ZIP = zip
! 19: ifeq ($(OS),Windows_NT)
! 20: RM = del
! 21: else
! 22: RM = rm -f
! 23: endif
! 24:
! 25: CFLAGS ?= -Os
! 26: CFLAGS += -Wall
! 27: CFLAGS += -W -Wstrict-prototypes
! 28:
! 29: CPPFLAGS += -DNDEBUG -D_WIN32_WINNT=0x501
! 30: CPPFLAGS += -Iinclude
! 31: CPPFLAGS += -I.
! 32:
1.1.1.2 misho 33: # -liphlpapi is needed for GetBestRoute() and GetIpAddrTable()
1.1.1.3 ! misho 34: LDLIBS = -lws2_32 -liphlpapi
! 35:
1.1 misho 36: PYTHON=\utils\python25\python
37: OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \
1.1.1.3 ! misho 38: minissdpc.o \
1.1 misho 39: miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
1.1.1.3 ! misho 40: connecthostport.o portlistingparse.o receivedata.o \
! 41: upnpdev.o addr_is_reserved.o
! 42: OBJSDLL=$(addprefix dll-, $(OBJS)) winres.o
! 43: BINARIES=upnpc-static.exe upnpc-shared.exe \
! 44: listdevices-static.exe listdevices-shared.exe \
! 45: miniupnpc.dll libminiupnpc.a \
! 46: testminixml.exe
! 47: ifneq ($(GITHUB_SHA),)
! 48: COMMITREF=$(GITHUB_SHA)
! 49: else
! 50: ifneq ($(CI_COMMIT_SHORT_SHA),)
! 51: COMMITREF=$(CI_COMMIT_SHORT_SHA)
! 52: else
! 53: COMMITREF=$(shell git rev-parse --short HEAD)
! 54: endif
! 55: endif
! 56: DISTFILE:=$(shell echo "miniupnpc-bin-win32-`cat VERSION`-$(COMMITREF).zip")
! 57:
! 58: LIBDIR ?= lib
! 59: # install directories
! 60: ifeq ($(strip $(PREFIX)),)
! 61: INSTALLPREFIX ?= /usr
! 62: else
! 63: INSTALLPREFIX ?= $(PREFIX)
! 64: endif
! 65:
! 66: .PHONY: all dist clean
1.1 misho 67:
1.1.1.3 ! misho 68: all: $(BINARIES)
1.1 misho 69:
1.1.1.3 ! misho 70: dist: $(DISTFILE)
1.1 misho 71:
72: clean:
1.1.1.3 ! misho 73: $(RM) miniupnpcstrings.h
! 74: $(RM) *.o
! 75: $(RM) *.exe
! 76: $(RM) miniupnpc.dll miniupnpc.lib miniupnpc.dll.def
! 77: $(RM) libminiupnpc.a
! 78: $(RM) $(DISTFILE)
! 79:
! 80: $(DISTFILE): $(BINARIES)
! 81: $(ZIP) $@ *.exe *.dll *.lib *.def *.a LICENSE README Changelog.txt
1.1 misho 82:
83: libminiupnpc.a: $(OBJS)
84: $(AR) cr $@ $?
85:
86: pythonmodule: libminiupnpc.a
1.1.1.3 ! misho 87: $(PYTHON) setupmingw32.py build $(SETUP_COMPILER_FLAG)
1.1 misho 88: $(PYTHON) setupmingw32.py install --skip-build
1.1.1.3 ! misho 89: $(PYTHON) setupmingw32.py bdist_wheel --skip-build
1.1 misho 90:
1.1.1.3 ! misho 91: miniupnpc.dll: miniupnpc.def $(OBJSDLL)
! 92: $(DLLWRAP) -k --driver-name $(CC) \
1.1 misho 93: --def miniupnpc.def \
94: --output-def miniupnpc.dll.def \
95: --implib miniupnpc.lib -o $@ \
96: $(OBJSDLL) $(LDLIBS)
97:
98: miniupnpc.lib: miniupnpc.dll
99:
1.1.1.3 ! misho 100: %.o: $(SRCDIR)/%.c
! 101: $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
! 102:
! 103: dll-%.o: $(SRCDIR)/%.c
! 104: $(CC) $(CFLAGS) $(CPPFLAGS) -DMINIUPNP_EXPORTS -c -o $@ $<
! 105:
! 106: %-shared.o: $(SRCDIR)/%.c
! 107: $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
! 108:
! 109: # --enable-stdcall-fixup
! 110: %-static.exe: %.o libminiupnpc.a
! 111: $(CC) -static -o $@ $^ $(LDLIBS)
! 112:
! 113: %-shared.exe: %-shared.o miniupnpc.lib
! 114: $(CC) -o $@ $^ $(LDLIBS)
! 115:
! 116: # To make miniupnpcstrings.h from miniupnpcstrings.h.in we either
! 117: # use a custom executable (if running make under windows) or use
! 118: # sed (if cross compiling from another platform).
! 119: ifeq ($(OS),Windows_NT)
! 120: wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c
! 121: $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
1.1 misho 122:
1.1.1.3 ! misho 123: miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe VERSION
! 124: .\wingenminiupnpcstrings.exe $< $@ rc_version.h
1.1 misho 125:
1.1.1.3 ! misho 126: rc_version.h: miniupnpcstrings.h
! 127: else
! 128: miniupnpcstrings.h: miniupnpcstrings.h.in VERSION
! 129: sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \
! 130: sed 's|MINIUPNPC_VERSION_STRING ".*"|MINIUPNPC_VERSION_STRING "$(shell cat VERSION)"|' > $@
1.1 misho 131:
1.1.1.3 ! misho 132: rc_version.h: VERSION
! 133: echo "#define LIBMINIUPNPC_DOTTED_VERSION \"$(shell cat VERSION)\"" > $@.tmp
! 134: echo "#define LIBMINIUPNPC_MAJOR_VERSION $(shell cat VERSION|cut -d. -f1)" >> $@.tmp
! 135: echo "#define LIBMINIUPNPC_MINOR_VERSION $(shell cat VERSION|cut -d. -f2)" >> $@.tmp
! 136: echo "#define LIBMINIUPNPC_MICRO_VERSION $(shell cat VERSION|cut -d. -f3)" >> $@.tmp
! 137: mv $@.tmp $@
! 138: endif
1.1 misho 139:
1.1.1.3 ! misho 140: miniupnpc.pc: VERSION
! 141: $(RM) $@
! 142: echo "prefix=$(INSTALLPREFIX)" >> $@
! 143: echo "exec_prefix=\$${prefix}" >> $@
! 144: echo "libdir=\$${exec_prefix}/$(LIBDIR)" >> $@
! 145: echo "includedir=\$${prefix}/include" >> $@
! 146: echo "" >> $@
! 147: echo "Name: miniUPnPc" >> $@
! 148: echo "Description: UPnP IGD client lightweight library" >> $@
! 149: echo "Version: $(shell cat VERSION)" >> $@
! 150: echo "Libs: -L\$${libdir} -lminiupnpc" >> $@
! 151: echo "Cflags: -I\$${includedir}" >> $@
1.1 misho 152:
1.1.1.3 ! misho 153: winres.o: miniupnpc.rc rc_version.h
! 154: $(WINDRES) -D INTERNAL_NAME=\\\"miniupnpc.dll\\0\\\" -i $< -o $@
1.1 misho 155:
1.1.1.3 ! misho 156: testminixml.exe: testminixml.o minixml.o igd_desc_parse.o
! 157: $(CC) -static -o $@ $^
1.1 misho 158:
1.1.1.3 ! misho 159: minixml.o: $(SRCDIR)/minixml.c $(SRCDIR)/minixml.h
1.1 misho 160:
1.1.1.3 ! misho 161: upnpc.o: include/miniwget.h $(SRCDIR)/minisoap.h include/miniupnpc.h include/igd_desc_parse.h
! 162: upnpc.o: include/upnpreplyparse.h include/upnpcommands.h include/upnperrors.h miniupnpcstrings.h
1.1 misho 163:
1.1.1.3 ! misho 164: miniwget.o: $(SRCDIR)/miniwget.c include/miniwget.h miniupnpcstrings.h $(SRCDIR)/connecthostport.h
1.1 misho 165:
1.1.1.3 ! misho 166: minisoap.o: $(SRCDIR)/minisoap.c $(SRCDIR)/minisoap.h miniupnpcstrings.h
1.1 misho 167:
1.1.1.3 ! misho 168: miniupnpc.o: $(SRCDIR)/miniupnpc.c include/miniupnpc.h $(SRCDIR)/minisoap.h \
! 169: include/miniwget.h $(SRCDIR)/minixml.h $(SRCDIR)/addr_is_reserved.h
1.1 misho 170:
1.1.1.3 ! misho 171: igd_desc_parse.o: $(SRCDIR)/igd_desc_parse.c include/igd_desc_parse.h
1.1 misho 172:
1.1.1.3 ! misho 173: upnpreplyparse.o: $(SRCDIR)/upnpreplyparse.c include/upnpreplyparse.h $(SRCDIR)/minixml.h
1.1 misho 174:
1.1.1.3 ! misho 175: upnpcommands.o: $(SRCDIR)/upnpcommands.c include/upnpcommands.h include/upnpreplyparse.h \
! 176: include/miniupnpc.h include/portlistingparse.h
1.1 misho 177:
1.1.1.3 ! misho 178: minissdpc.o: $(SRCDIR)/minissdpc.c $(SRCDIR)/minissdpc.h $(SRCDIR)/receivedata.h
1.1 misho 179:
1.1.1.3 ! misho 180: upnpdev.o: $(SRCDIR)/upnpdev.c include/upnpdev.h
1.1 misho 181:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>