Files
deb-notifier/Makefile
T
2026-11-27 11:48:27 +01:00

35 lines
1.0 KiB
Makefile

PACKAGE := notifier
VERSION ?=
REVISION ?= 1
SRC_DIR ?= src
SRC_FILES ?= api_client.py config.py credentials.py main.py models.py notifier.py poller.py
BUILD_DIR := build
STAGE := $(BUILD_DIR)/stage
DEB := $(BUILD_DIR)/$(PACKAGE)_$(VERSION)-$(REVISION)_all.deb
.PHONY: all check clean
all: $(DEB)
check:
@test -n "$(VERSION)" || { echo "VERSION is required (make VERSION=1.0.0)"; exit 1; }
@test -d "$(SRC_DIR)" || { echo "SRC_DIR '$(SRC_DIR)' not found"; exit 1; }
@for f in $(SRC_FILES); do \
test -f "$(SRC_DIR)/$$f" || { echo "Missing source file: $(SRC_DIR)/$$f"; exit 1; }; \
done
$(DEB): check
rm -rf $(STAGE)
mkdir -p $(STAGE)
cp -a pkg/. $(STAGE)/
for f in $(SRC_FILES); do \
install -D -m 644 "$(SRC_DIR)/$$f" "$(STAGE)/usr/lib/notifier/$$f"; \
done
sed -i 's/@VERSION@/$(VERSION)-$(REVISION)/' $(STAGE)/DEBIAN/control
chmod 755 $(STAGE)/DEBIAN $(STAGE)/DEBIAN/postinst $(STAGE)/DEBIAN/prerm $(STAGE)/usr/bin/notifier
dpkg-deb --build --root-owner-group $(STAGE) $@
@echo "Built $@"
clean:
rm -rf $(BUILD_DIR)