49 lines
1.4 KiB
Makefile
Executable File
49 lines
1.4 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
|
|
define checkdir
|
|
@test -f debian/rules || \
|
|
(echo Not in correct source directory; exit 1)
|
|
endef
|
|
|
|
define checkroot
|
|
@test $$(id -u) = 0 || (echo need root priviledges; exit 1)
|
|
endef
|
|
|
|
PRODUCT = alertmanager
|
|
TOP_DIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
|
SRC_DIR = $(TOP_DIR)
|
|
DEB_DIR = $(TOP_DIR)/debian
|
|
DEST_DIR = $(DEB_DIR)/$(PRODUCT)
|
|
|
|
BIN_DIR = $(DEST_DIR)/usr/bin
|
|
CONF_DIR = $(DEST_DIR)/etc/prometheus
|
|
DEFAULT_DIR = $(DEST_DIR)/etc/default
|
|
DOCS_DIR = $(DEST_DIR)/usr/share/doc/$(PRODUCT)
|
|
SYSD_DIR = $(DEST_DIR)/usr/lib/systemd/system
|
|
|
|
build:
|
|
|
|
binary:
|
|
$(checkdir)
|
|
$(checkroot)
|
|
mkdir -p $(DEST_DIR)/DEBIAN $(BIN_DIR) $(CONF_DIR) $(DEFAULT_DIR) $(DOCS_DIR) $(SYSD_DIR)
|
|
install -Dm755 $(SRC_DIR)/$(PRODUCT) -t $(BIN_DIR)
|
|
install -Dm755 $(SRC_DIR)/amtool -t $(BIN_DIR)
|
|
install -Dm644 $(SRC_DIR)/LICENSE -t $(DOCS_DIR)
|
|
install -Dm644 $(SRC_DIR)/NOTICE -t $(DOCS_DIR)
|
|
install -Dm755 $(DEB_DIR)/postinst -t $(DEST_DIR)/DEBIAN
|
|
install -Dm644 $(SRC_DIR)/$(PRODUCT).yml $(CONF_DIR)/$(PRODUCT).yml
|
|
install -Dm644 $(DEB_DIR)/default $(DEFAULT_DIR)/$(PRODUCT)
|
|
install -Dm644 $(DEB_DIR)/service $(SYSD_DIR)/$(PRODUCT).service
|
|
dpkg-gencontrol -P$(DEST_DIR)
|
|
cd $(DEST_DIR) && find . -type f ! -regex '.*DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums
|
|
dpkg-deb -b $(DEST_DIR) ../
|
|
|
|
clean:
|
|
$(checkdir)
|
|
-rm -rf debian/$(PRODUCT)
|
|
-rm -f debian/files
|
|
-rm -f debian/substvars
|
|
|
|
.PHONY: binary clean
|