summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-21 19:54:45 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-21 20:16:37 -0400
commitd713eacb7ec390d8a0d8610cab61df57e8bd9ae3 (patch)
tree3731f65b3c0e96c29b54d5e668e195002778403b /Makefile
parent9e0d797ba7a14ffc4611655008f926f84e896918 (diff)
downloadpython-systemd-d713eacb7ec390d8a0d8610cab61df57e8bd9ae3.tar.gz
Store id128-constants.h in the repository
Instead of generating the list of message ids anew during every build, the file is generated manually and committed into the repository. Also, the list of defines is stored in id128-defines.h, also kept in the repository. Both files should only grow. This should make build easier. But it also fixes a problem with systemd, which occasionally drops message definitions. We will keep them forever, so it should be safe to rely on the presence of message definitions which systemd does not use anymore. Fixes #23.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 13 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 0a5b2b9..dc5e78c 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PYTHON = python
SED = sed
SPHINX_BUILD = sphinx-build
ETAGS = etags
-INCLUDE_DIR = /usr/include/
+INCLUDE_DIR := $(shell pkg-config --variable=includedir libsystemd)
VERSION := $(shell $(PYTHON) setup.py --version)
TESTFLAGS = -v
@@ -15,6 +15,17 @@ builddir := $(shell $(PYTHON) -c '$(buildscript)')
all: build
+.PHONY: update-constants
+update-constants: $(INCLUDE_DIR)/systemd/sd-messages.h
+ cat $< systemd/id128-defines.h | \
+ $(SED) -n -r '/#define SD_MESSAGE_[A-Z0-9_]/p' | \
+ sort -u | \
+ tee systemd/id128-defines.h.tmp | \
+ $(SED) -n -r 's/,//g; s/#define (SD_MESSAGE_[A-Z0-9_]+)\s.*/add_id(m, "\1", \1) JOINER/p' | \
+ sort -u >systemd/id128-constants.h.tmp
+ mv systemd/id128-defines.h{.tmp,}
+ mv systemd/id128-constants.h{.tmp,}
+
build:
$(PYTHON) setup.py build
@@ -28,7 +39,7 @@ clean:
rm -rf build systemd/*.so systemd/*.py[co] *.py[co] systemd/__pycache__
distclean: clean
- rm -rf dist MANIFEST systemd/id128-constants.h
+ rm -rf dist MANIFEST
SPHINXOPTS = -D version=$(VERSION) -D release=$(VERSION)
sphinx-%: build