| git.druid.rocks | index | druid520 | mp | src/ | version.c |
src/version.c
#define _POSIX_C_SOURCE 200809L
#define _NETBSD_SOURCE 1
#include <stdio.h>
#include "mpx.h"
#include "buildinfo.h"
/* MP_VERSION, MP_BUILD_CC, MP_BUILD_TARGET, and mp_build_cflags
* (buildinfo.h) are generated fresh by mk/b.sh right before the real
* compile, from that exact build's own src/version.pl/cc/ccflgs
* (sanitizer flags included, if the probe earlier in mk/b.sh found
* them usable) -- never hand-maintained, so this can never drift from
* what actually went into the binary printing it. mp_build_cflags is
* one short string per flag, not ccflgs as a single literal -- see
* buildinfo.h's own generation comment in mk/b.sh for why (a real C89
* string-literal length limit, not a style choice). MP_VERSION is
* mp's own version, not a separate one for mpx -- the two are always
* built from the identical commit, one mk/b.sh run makes both, so
* there is no such thing as "mpx version 4.1.0 paired with mp version
* 4.0.9" to distinguish. */
void
cmd_version(int argc, char** argv)
{
long i;
if(argc != 2)
{
badusage(argv[0], "version");
}
printf("mpx %s built with: cc=%s target=%s\n", MP_VERSION, MP_BUILD_CC, MP_BUILD_TARGET);
printf("cflags:");
for(i = 0; mp_build_cflags[i] != NULL; i = i + 1)
{
printf(" %s", mp_build_cflags[i]);
}
printf("\n");
}