Merge pull request #434 from pali/master

Fix and simplify Makefile.mingw for miniupnpc
This commit is contained in:
Thomas BERNARD 2020-04-06 12:05:56 +02:00 committed by GitHub
commit c5e8694746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 35 deletions

View File

@ -28,7 +28,7 @@ build_script:
- mingw32-make -f Makefile.mingw pythonmodule PYTHON=%PYTHON_VER% - mingw32-make -f Makefile.mingw pythonmodule PYTHON=%PYTHON_VER%
after_build: after_build:
- 7z a ..\miniupnpc-%APPVEYOR_BUILD_VERSION%.zip *.exe *.dll *.a *.lib - 7z a -x!wingenminiupnpcstrings.exe ..\miniupnpc-%APPVEYOR_BUILD_VERSION%.zip *.exe *.dll *.a *.lib
artifacts: artifacts:
- path: miniupnpc-$(appveyor_build_version).zip - path: miniupnpc-$(appveyor_build_version).zip

View File

@ -27,20 +27,16 @@ OBJS=miniwget.o minixml.o igd_desc_parse.o minisoap.o \
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \ miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
connecthostport.o portlistingparse.o receivedata.o \ connecthostport.o portlistingparse.o receivedata.o \
upnpdev.o upnpdev.o
OBJSDLL=$(addprefix dll/, $(OBJS)) OBJSDLL=$(addprefix dll-, $(OBJS))
all: init upnpc-static upnpc-shared testminixml libminiupnpc.a \ all: upnpc-static.exe upnpc-shared.exe testminixml.exe libminiupnpc.a \
miniupnpc.dll listdevices miniupnpc.dll listdevices-static.exe listdevices-shared.exe
init:
mkdir dll
echo init > init
clean: clean:
$(RM) upnpc testminixml *.o $(RM) miniupnpcstrings.h
$(RM) dll\*.o $(RM) *.o
$(RM) *.exe $(RM) *.exe
$(RM) miniupnpc.dll $(RM) miniupnpc.dll miniupnpc.lib miniupnpc.dll.def
$(RM) libminiupnpc.a $(RM) libminiupnpc.a
libminiupnpc.a: $(OBJS) libminiupnpc.a: $(OBJS)
@ -51,7 +47,7 @@ pythonmodule: libminiupnpc.a
$(PYTHON) setupmingw32.py install --skip-build $(PYTHON) setupmingw32.py install --skip-build
$(PYTHON) setupmingw32.py bdist_wheel --skip-build $(PYTHON) setupmingw32.py bdist_wheel --skip-build
miniupnpc.dll: libminiupnpc.a $(OBJSDLL) miniupnpc.dll: miniupnpc.def $(OBJSDLL)
$(DLLWRAP) -k --driver-name $(CC) \ $(DLLWRAP) -k --driver-name $(CC) \
--def miniupnpc.def \ --def miniupnpc.def \
--output-def miniupnpc.dll.def \ --output-def miniupnpc.dll.def \
@ -59,39 +55,31 @@ miniupnpc.dll: libminiupnpc.a $(OBJSDLL)
$(OBJSDLL) $(LDLIBS) $(OBJSDLL) $(LDLIBS)
miniupnpc.lib: miniupnpc.dll miniupnpc.lib: miniupnpc.dll
# echo $@ generated with $<
dll/upnpc.o: upnpc.o %.o: %.c
# echo $@ generated with $<
.c.o:
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $< $(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $<
$(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o dll/$@ $<
upnpc.o: upnpc.c dll-%.o: %.c
$(CC) $(CFLAGS) -DMINIUPNP_STATICLIB -c -o $@ $< $(CC) $(CFLAGS) -DMINIUPNP_EXPORTS -c -o $@ $<
$(CC) $(CFLAGS) -c -o dll/$@ $<
%-shared.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
# --enable-stdcall-fixup # --enable-stdcall-fixup
upnpc-static: upnpc.o libminiupnpc.a %-static.exe: %.o libminiupnpc.a
$(CC) -static -o $@ $^ $(LDLIBS)
%-shared.exe: %-shared.o miniupnpc.lib
$(CC) -o $@ $^ $(LDLIBS) $(CC) -o $@ $^ $(LDLIBS)
upnpc-shared: dll/upnpc.o miniupnpc.lib
$(CC) -o $@ $^ $(LDLIBS)
listdevices: listdevices.o libminiupnpc.a
$(CC) -o $@ $^ $(LDLIBS)
wingenminiupnpcstrings: wingenminiupnpcstrings.o
wingenminiupnpcstrings.o: wingenminiupnpcstrings.c
# To make miniupnpcstrings.h from miniupnpcstrings.h.in we either # To make miniupnpcstrings.h from miniupnpcstrings.h.in we either
# use a custom executable (if running make under windows) or use # use a custom executable (if running make under windows) or use
# sed (if cross compiling from another platform). # sed (if cross compiling from another platform).
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c
wingenminiupnpcstrings $< $@ $(CC) $(CFLAGS) -o $@ $^
miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe
wingenminiupnpcstrings.exe $< $@
else else
miniupnpcstrings.h: miniupnpcstrings.h.in VERSION miniupnpcstrings.h: miniupnpcstrings.h.in VERSION
sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \ sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \
@ -111,7 +99,7 @@ miniupnpc.o: miniupnpc.c miniupnpc.h minisoap.h miniwget.h minixml.h
igd_desc_parse.o: igd_desc_parse.c igd_desc_parse.h igd_desc_parse.o: igd_desc_parse.c igd_desc_parse.h
testminixml: minixml.o igd_desc_parse.o testminixml.c testminixml.exe: minixml.o igd_desc_parse.o testminixml.c
upnpreplyparse.o: upnpreplyparse.c upnpreplyparse.h minixml.h upnpreplyparse.o: upnpreplyparse.c upnpreplyparse.h minixml.h

View File

@ -5,6 +5,9 @@ LIBRARY
EXPORTS EXPORTS
; miniupnpc ; miniupnpc
upnpDiscover upnpDiscover
upnpDiscoverDevice
upnpDiscoverDevices
upnpDiscoverAll
freeUPNPDevlist freeUPNPDevlist
parserootdesc parserootdesc
UPNP_GetValidIGD UPNP_GetValidIGD