Compare commits

..

No commits in common. "fda25171b2358c04b465eee79cb6cc23776fe186" and "19806ab0b599dbf63afb14784e8e683ac99a14d1" have entirely different histories.

2 changed files with 8 additions and 15 deletions

View file

@ -1,21 +1,16 @@
GITREV ?= $(shell git describe --dirty --always)
BLDDATE ?= $(shell date -I)
CR_YEAR ?= $(shell date +%Y)
VERSION ?= "v0.1.2"
CFLAGS ?= -Wall -Wextra -Wpedantic -O2 -std=gnu99
CFLAGS += -DGITREV='"$(GITREV)"'
CFLAGS += -DBLDDATE='"$(BLDDATE)"'
CFLAGS += -DCR_YEAR='"$(CR_YEAR)"'
CFLAGS += -DVERSION='$(VERSION)'
# Soon...
# CFLAGS += $(shell pkg-config --cflags libudev)
# LIBS += $(shell pkg-config --libs libudev)
PREFIX ?= /usr/local
DESTDIR ?=
writeimg: writeimg.c
$(CC) $(CFLAGS) $(LIBS) -o $@ $^
@ -23,4 +18,4 @@ clean:
rm -f *.o writeimg
install: writeimg
install -m 0755 $< $(DESTDIR)$(PREFIX)/bin/$<
install -m 0755 writeimg /usr/local/bin/writeimg

View file

@ -10,12 +10,10 @@
#include <sys/stat.h>
#include <unistd.h>
#ifndef GITREV
#define GITREV "unknown"
#endif
#ifndef VERSION
#define VERSION "unknown"
#ifdef GITREV
#define VERSION GITREV
#else
#define VERSION "1.0.0"
#endif
#ifndef CR_YEAR
@ -129,11 +127,11 @@ static const struct option longopts[] = {
};
int main(int argc, char *argv[]) {
printf("%s %s, Rev. %s\n", basename(argv[0]), VERSION, GITREV);
fprintf(stdout, copyright, CR_YEAR);
printf("%s version %s\n", basename(argv[0]), VERSION);
#ifdef BLDDATE
printf("Build date: %s\n", BLDDATE);
#endif
fprintf(stdout, copyright, CR_YEAR);
printf("\n");
/* Line buffering, system allocated */