make: support out-of-git builds

E.g. releases would be these with git archive and such.
This commit is contained in:
Jari Vetoniemi 2020-02-08 12:05:41 +02:00
parent 9295dc0016
commit b322e50798

View File

@ -4,7 +4,7 @@ bindir ?= /bin
libdir ?= /lib
mandir ?= /share/man/man1
GIT_SHA1 = $(shell git rev-parse HEAD)
GIT_SHA1 = $(shell git rev-parse HEAD 2>/dev/null || printf 'nogit')
MAKEFLAGS += --no-builtin-rules
WARNINGS = -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \
@ -26,6 +26,11 @@ curses: bemenu-renderer-curses.so
x11: bemenu-renderer-x11.so
wayland: bemenu-renderer-wayland.so
# support non git builds
.git/index:
mkdir -p .git
touch .git/index
%.a:
$(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@