Luna/kernel/src/config.cpp

40 lines
745 B
C++
Raw Normal View History

#include "config.h"
#include "std/stdio.h"
#define STRINGIZE(x) #x
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
int __moon_version_major()
{
#ifndef MOON_MAJOR
return 0;
#else
return MOON_MAJOR;
#endif
}
int __moon_version_minor()
{
#ifndef MOON_MINOR
return 3;
#else
return MOON_MINOR;
#endif
}
const char* __moon_version_suffix()
{
#ifndef _MOON_SUFFIX
return "";
#else
return STRINGIZE_VALUE_OF(_MOON_SUFFIX);
#endif
}
const char* moon_version()
{
static char version[64];
snprintf(version, sizeof(version), "%d.%d%s", __moon_version_major(), __moon_version_minor(),
__moon_version_suffix()); // FIXME: this string is constant each build and should only be calculated once
return version;
}