Compare commits
2 commits
19806ab0b5
...
fda25171b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fda25171b2 | ||
|
|
9add3b7667 |
2 changed files with 15 additions and 8 deletions
7
Makefile
7
Makefile
|
|
@ -1,16 +1,21 @@
|
||||||
GITREV ?= $(shell git describe --dirty --always)
|
GITREV ?= $(shell git describe --dirty --always)
|
||||||
BLDDATE ?= $(shell date -I)
|
BLDDATE ?= $(shell date -I)
|
||||||
CR_YEAR ?= $(shell date +%Y)
|
CR_YEAR ?= $(shell date +%Y)
|
||||||
|
VERSION ?= "v0.1.2"
|
||||||
|
|
||||||
CFLAGS ?= -Wall -Wextra -Wpedantic -O2 -std=gnu99
|
CFLAGS ?= -Wall -Wextra -Wpedantic -O2 -std=gnu99
|
||||||
CFLAGS += -DGITREV='"$(GITREV)"'
|
CFLAGS += -DGITREV='"$(GITREV)"'
|
||||||
CFLAGS += -DBLDDATE='"$(BLDDATE)"'
|
CFLAGS += -DBLDDATE='"$(BLDDATE)"'
|
||||||
CFLAGS += -DCR_YEAR='"$(CR_YEAR)"'
|
CFLAGS += -DCR_YEAR='"$(CR_YEAR)"'
|
||||||
|
CFLAGS += -DVERSION='$(VERSION)'
|
||||||
|
|
||||||
# Soon...
|
# Soon...
|
||||||
# CFLAGS += $(shell pkg-config --cflags libudev)
|
# CFLAGS += $(shell pkg-config --cflags libudev)
|
||||||
# LIBS += $(shell pkg-config --libs libudev)
|
# LIBS += $(shell pkg-config --libs libudev)
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
DESTDIR ?=
|
||||||
|
|
||||||
writeimg: writeimg.c
|
writeimg: writeimg.c
|
||||||
$(CC) $(CFLAGS) $(LIBS) -o $@ $^
|
$(CC) $(CFLAGS) $(LIBS) -o $@ $^
|
||||||
|
|
||||||
|
|
@ -18,4 +23,4 @@ clean:
|
||||||
rm -f *.o writeimg
|
rm -f *.o writeimg
|
||||||
|
|
||||||
install: writeimg
|
install: writeimg
|
||||||
install -m 0755 writeimg /usr/local/bin/writeimg
|
install -m 0755 $< $(DESTDIR)$(PREFIX)/bin/$<
|
||||||
|
|
|
||||||
14
writeimg.c
14
writeimg.c
|
|
@ -10,10 +10,12 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef GITREV
|
#ifndef GITREV
|
||||||
#define VERSION GITREV
|
#define GITREV "unknown"
|
||||||
#else
|
#endif
|
||||||
#define VERSION "1.0.0"
|
|
||||||
|
#ifndef VERSION
|
||||||
|
#define VERSION "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CR_YEAR
|
#ifndef CR_YEAR
|
||||||
|
|
@ -127,11 +129,11 @@ static const struct option longopts[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
printf("%s version %s\n", basename(argv[0]), VERSION);
|
printf("%s %s, Rev. %s\n", basename(argv[0]), VERSION, GITREV);
|
||||||
|
fprintf(stdout, copyright, CR_YEAR);
|
||||||
#ifdef BLDDATE
|
#ifdef BLDDATE
|
||||||
printf("Build date: %s\n", BLDDATE);
|
printf("Build date: %s\n", BLDDATE);
|
||||||
#endif
|
#endif
|
||||||
fprintf(stdout, copyright, CR_YEAR);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
/* Line buffering, system allocated */
|
/* Line buffering, system allocated */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue