summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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