commit: c0d63696fa28c69343b29b3577b23461507a1a1f
parent: d412604e90d79e1abb4838a08f5c6fee4ad27fb5
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 23 Feb 2020 22:09:26 +0100
Makefile: fix for NetBSD make
Diffstat:
M | Makefile | 38 | ++++++++++++++++++++------------------ |
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,39 +1,41 @@
-.POSIX:
+# POSIX-ish Makefile with extensions common to *BSD and GNU such as:
+# - Usage of backticks for shell evaluation
+# - Usage of ?= for defining variables when not already defined
+# - Usage of += for appending to a variable
+
+VERSION = 0.0.1
+VERSION_FULL = $(VERSION)`./version.sh`
PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
DATADIR = $(PREFIX)/share/inaban
-PACKAGE = inaban
+
+CC ?= cc
+CFLAGS ?= -g -Wall -Wextra -Wconversion -Wsign-conversion -O2
+DBG ?=
+PKGCONFIG ?= pkg-config
DEPS = xkbcommon wlroots wayland-server
EXE = inaban
TRANS =
-CC = cc
-CFLAGS = -g -Wall -Wextra -Wconversion -Wsign-conversion
-CDEPS = `pkg-config --cflags $(DEPS)` -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_POSIX_C_SOURCE=200809L -DWLR_USE_UNSTABLE
+CDEPS = -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_POSIX_C_SOURCE=200809L -DWLR_USE_UNSTABLE -I.
+CDEPS += `pkg-config --cflags $(DEPS)`
LIBS = `pkg-config --libs $(DEPS)`
-WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
-WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
+WAYLAND_PROTOCOLS=`pkg-config --variable=pkgdatadir wayland-protocols`
+WAYLAND_SCANNER=`pkg-config --variable=wayland_scanner wayland-scanner`
all: xdg-shell-protocol.c $(EXE) $(TRANS)
-po/messages.pot: $(EXE).c
- xgettext --keyword=_ --language=C -o $@ --add-comments --sort-output -j $<
-
-po/%.po: po/messages.pot
- msgmerge --update $@ $<
-
-${TRANS}: po/${@:.mo=.po}
- mkdir -p locale/${@:.mo=}/LC_MESSAGES
- msgfmt -o locale/${@:.mo=}/LC_MESSAGES/$(PACKAGE).mo po/${@:.mo=.po}
-
inaban: config.h inaban.h inaban.c
.c:
- $(CC) -std=c99 -I. $(CFLAGS) $(CDEPS) -o $@ $< $(LDFLAGS) $(LIBS)
+ $(CC) -std=c99 $(CFLAGS) $(CDEPS) $(LDFLAGS) $(LIBS) -o $@ $<
+
+.c.o:
+ $(CC) -std=c99 $(CFLAGS) $(CDEPS) -c -o $@ $<
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@