Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: use time based build versioning
Browse files Browse the repository at this point in the history
tshakalekholoane committed Sep 8, 2024
1 parent c587c2e commit fd902d0
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
BUILD := $(shell printf "%s (%s)\n" "$(shell date -u +"%Y.%m.%d")" "$(shell git log -n 1 --pretty=format:%H | head --bytes 7)")
CC := clang

CFLAGS := -O3 -Wall -Weverything -Wextra -Wno-c++98-compat \
-Wno-declaration-after-statement -Wno-format-nonliteral -Wno-vla \
CFLAGS := -DBUILD="\"$(BUILD)\"" -O3 -Wall -Weverything -Wextra \
-Wno-c++98-compat -Wno-declaration-after-statement -Wno-format-nonliteral \
-Wno-vla -Wno-incompatible-pointer-types-discards-qualifiers \
-Wno-poison-system-directories -framework Foundation -pedantic -std=c17

SRC := src/main.c

OUT := bin/can
OUT_AMD64 := bin/can_amd64
OUT_AARCH64 := bin/can_aarch64
SRC := src/main.c

.PHONY: all clean

6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -6,7 +6,9 @@
#include <string.h>
#include <unistd.h>

#define VERSION "0.5.0"
#ifndef BUILD
#define BUILD "TIP"
#endif

static const char* usage = "usage: can [-h | -V] file ...";

@@ -79,7 +81,7 @@ int main(int argc, char* argv[argc + 1]) {
}

if (version) {
printf("can %s\n", VERSION);
printf("can %s\n", BUILD);
return EXIT_SUCCESS;
}

0 comments on commit fd902d0

Please sign in to comment.