diff --git a/miniupnpc/Makefile.mingw b/miniupnpc/Makefile.mingw index a690cfc..07ae206 100644 --- a/miniupnpc/Makefile.mingw +++ b/miniupnpc/Makefile.mingw @@ -96,8 +96,11 @@ dll-%.o: %.c ifeq ($(OS),Windows_NT) wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c $(CC) $(CFLAGS) -o $@ $^ -miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe - wingenminiupnpcstrings.exe $< $@ + +miniupnpcstrings.h: miniupnpcstrings.h.in wingenminiupnpcstrings.exe VERSION + wingenminiupnpcstrings.exe $< $@ rc_version.h + +rc_version.h: miniupnpcstrings.h else miniupnpcstrings.h: miniupnpcstrings.h.in VERSION sed 's|OS_STRING ".*"|OS_STRING "Windows/Mingw32"|' $< | \ diff --git a/miniupnpc/wingenminiupnpcstrings.c b/miniupnpc/wingenminiupnpcstrings.c index 50df06a..b3a085a 100644 --- a/miniupnpc/wingenminiupnpcstrings.c +++ b/miniupnpc/wingenminiupnpcstrings.c @@ -1,8 +1,8 @@ /* $Id: wingenminiupnpcstrings.c,v 1.4 2015/02/08 08:46:06 nanard Exp $ */ /* Project: miniupnp - * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ + * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * Author: Thomas Bernard - * Copyright (c) 2005-2015 Thomas Bernard + * Copyright (c) 2005-2020 Thomas Bernard * This software is subjects to the conditions detailed * in the LICENSE file provided within this distribution */ #include @@ -79,5 +79,37 @@ int main(int argc, char * * argv) { fclose(fout); printf("%d lines written to %s.\n", n, argv[2]); } + if(argc >= 4) { + fout = fopen(argv[3], "w"); + if(fout == NULL) { + fprintf(stderr, "Cannot open %s for writing.\n", argv[2]); + return 1; + } else { + char * cur, * next; + fprintf(fout, "#define LIBMINIUPNPC_DOTTED_VERSION \"%s\"\n", miniupnpcVersion); + next = strchr(miniupnpcVersion, '.'); + if (next && *next) { + *next = '\0'; + next++; + } + fprintf(fout, "#define LIBMINIUPNPC_MAJOR_VERSION %s\n", miniupnpcVersion); + cur = next; + next = strchr(cur, '.'); + if (next && *next) { + *next = '\0'; + next++; + } + fprintf(fout, "#define LIBMINIUPNPC_MINOR_VERSION %s\n", cur); + cur = next; + next = strchr(cur, '.'); + if (next && *next) { + *next = '\0'; + next++; + } + fprintf(fout, "#define LIBMINIUPNPC_MICRO_VERSION %s\n", cur); + fclose(fout); + printf("%s written\n", argv[3]); + } + } return 0; }