Archived
1
Fork 0

Use commit hash as version number

Might be a horrible idea
This commit is contained in:
Hadeed 2023-09-06 16:43:40 +05:00
parent 3ffc185f28
commit 695dd854d6
4 changed files with 6 additions and 3 deletions

View file

@ -1,3 +1,4 @@
HASH := $(shell git rev-parse --short HEAD)
SRCS := $(wildcard src/*.c)
OBJS := $(SRCS:src/%.c=build/%.o)
DEPS := $(OBJS:%.o=%.d)
@ -6,7 +7,7 @@ WARNING_FLAGS := -Wall -Wextra
INCLUDE_FLAGS := -I include
CC := clang
CFLAGS := $(WARNING_FLAGS) $(INCLUDE_FLAGS) -MMD -MP -std=c99 -ggdb
CFLAGS := $(WARNING_FLAGS) $(INCLUDE_FLAGS) -DKILO_COMMIT_HASH=$(HASH) -MMD -MP -std=c99 -ggdb
kilo: $(OBJS)
$(CC) $(CFLAGS) $^ -o $@

View file

@ -1,7 +1,6 @@
#ifndef KILO_H
#define KILO_H
#define KILO_VERSION "0.0.1"
#define KILO_TAB_STOP 4
#include <termios.h>

View file

@ -6,6 +6,9 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define _STRINGIZE(x) #x
#define STRINGIZE(x) _STRINGIZE(x)
typedef int ERRCODE;
#define RETURN(code) do {errcode = code; goto END;} while(0)

View file

@ -50,7 +50,7 @@ static void ui_draw_rows(struct append_buf *draw_buf) {
} else if (no_file && y == E.screenrows / 2) {
char welcome[64];
int len = snprintf(welcome, sizeof(welcome),
"Welcome to kilo! -- v%s", KILO_VERSION);
"Welcome to kilo! -- %s", STRINGIZE(KILO_COMMIT_HASH));
int padding = (E.screencols - len) / 2;
for (int i = 0; i < padding; i++)