version.c (1009B)
1 /* kit version / build provenance. 2 * 3 * The three strings below are injected once per `make` invocation into this 4 * single translation unit (see mk/flags.mk + the version.o rule in the 5 * Makefile), so a version bump or a new commit recompiles only version.o and 6 * not the world. The compiled-in defaults keep a standalone compile working. 7 * 8 * These are driver-internal provenance accessors, not libkit public API; they 9 * live in driver.h, not include/kit/. The single source of truth for the 10 * version string is the committed top-level VERSION file (CalVer 11 * YYYY.MINOR.PATCH). See doc/plan/SELFDIST.md. */ 12 13 #include "driver.h" 14 15 #ifndef KIT_VERSION_STR 16 #define KIT_VERSION_STR "0.0.0" 17 #endif 18 #ifndef KIT_BUILD_ID 19 #define KIT_BUILD_ID "unknown" 20 #endif 21 #ifndef KIT_HOST_TRIPLE 22 #define KIT_HOST_TRIPLE "unknown" 23 #endif 24 25 const char* kit_version_string(void) { return KIT_VERSION_STR; } 26 const char* kit_build_id(void) { return KIT_BUILD_ID; } 27 const char* kit_host_triple(void) { return KIT_HOST_TRIPLE; }