wingenminiupnpcstrings also generates rc_version.h

This commit is contained in:
Thomas Bernard 2020-11-30 01:37:19 +01:00
parent f04dbafe09
commit b28462b62a
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
2 changed files with 39 additions and 4 deletions

View File

@ -96,8 +96,11 @@ dll-%.o: %.c
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c wingenminiupnpcstrings.exe: wingenminiupnpcstrings.c
$(CC) $(CFLAGS) -o $@ $^ $(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 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"|' $< | \

View File

@ -1,8 +1,8 @@
/* $Id: wingenminiupnpcstrings.c,v 1.4 2015/02/08 08:46:06 nanard Exp $ */ /* $Id: wingenminiupnpcstrings.c,v 1.4 2015/02/08 08:46:06 nanard Exp $ */
/* Project: miniupnp /* Project: miniupnp
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
* Author: Thomas Bernard * Author: Thomas Bernard
* Copyright (c) 2005-2015 Thomas Bernard * Copyright (c) 2005-2020 Thomas Bernard
* This software is subjects to the conditions detailed * This software is subjects to the conditions detailed
* in the LICENSE file provided within this distribution */ * in the LICENSE file provided within this distribution */
#include <stdio.h> #include <stdio.h>
@ -79,5 +79,37 @@ int main(int argc, char * * argv) {
fclose(fout); fclose(fout);
printf("%d lines written to %s.\n", n, argv[2]); 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; return 0;
} }