Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

makefile: improve specifying destinations & update package.sh to match #437

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
PREFIX ?= /
PREFIX ?= /usr
SYSTEMDUNITDIR ?= $(PREFIX)/lib/systemd/system
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SYSCONFDIR ?= /etc

SRC_DIR := $(dir $(lastword $(MAKEFILE_LIST)))

ANANICY_D_R := $(shell find $(SRC_DIR)/ananicy.d -type f -name "*.rules")
ANANICY_D_R_I := $(patsubst $(SRC_DIR)/%.rules, $(PREFIX)/etc/%.rules, $(ANANICY_D_R))
ANANICY_D_R_I := $(patsubst $(SRC_DIR)/%.rules, $(SYSCONFDIR)/%.rules, $(ANANICY_D_R))

ANANICY_D_T := $(shell find $(SRC_DIR)/ananicy.d -type f -name "*.types")
ANANICY_D_T_I := $(patsubst $(SRC_DIR)/%.types, $(PREFIX)/etc/%.types, $(ANANICY_D_T))
ANANICY_D_T_I := $(patsubst $(SRC_DIR)/%.types, $(SYSCONFDIR)/%.types, $(ANANICY_D_T))

ANANICY_D_G := $(shell find $(SRC_DIR)/ananicy.d -type f -name "*.cgroups")
ANANICY_D_G_I := $(patsubst $(SRC_DIR)/%.cgroups, $(PREFIX)/etc/%.cgroups, $(ANANICY_D_G))
ANANICY_D_G_I := $(patsubst $(SRC_DIR)/%.cgroups, $(SYSCONFDIR)/%.cgroups, $(ANANICY_D_G))

A_SERVICE := $(PREFIX)/lib/systemd/system/ananicy.service
A_CONF := $(PREFIX)/etc/ananicy.d/ananicy.conf
A_BIN := $(PREFIX)/usr/bin/ananicy
A_SERVICE := $(LIBDIR)/systemd/system/ananicy.service
A_CONF := $(SYSCONFDIR)/ananicy.d/ananicy.conf
A_BIN := $(BINDIR)/ananicy


default: help

$(PREFIX)/etc/%.cgroups: $(SRC_DIR)/%.cgroups
$(SYSCONFDIR)/%.cgroups: $(SRC_DIR)/%.cgroups
install -Dm644 $< $@

$(PREFIX)/etc/%.types: $(SRC_DIR)/%.types
$(SYSCONFDIR)/%.types: $(SRC_DIR)/%.types
install -Dm644 $< $@

$(PREFIX)/etc/%.rules: $(SRC_DIR)/%.rules
$(SYSCONFDIR)/%.rules: $(SRC_DIR)/%.rules
install -Dm644 $< $@

$(A_CONF): $(SRC_DIR)/ananicy.d/ananicy.conf
Expand Down
10 changes: 7 additions & 3 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ debian_package(){
VERSION=$(git tag --sort version:refname | tail -n 1)
[ -z "$VERSION" ] && ERRO "Can't get git tag, VERSION are empty!"
DEB_NAME="ananicy-${VERSION}_any"

# cleanup after previous installation
rm "./${DEB_NAME}.deb" && rm -rf "${DEB_NAME}"

mkdir -p "${DEB_NAME}"
make install PREFIX="${DEB_NAME}"
make install \
PREFIX="${DEB_NAME}" \
SYSCONFDIR="${DEB_NAME}/etc" \
SYSTEMDUNITDIR=/lib/systemd/system

mkdir -p "${DEB_NAME}/DEBIAN/"
{
echo "Package: ananicy"
Expand Down