Skip to content

Commit

Permalink
Makefile: Add Makefile file
Browse files Browse the repository at this point in the history
The intent is mainly to automate the installation and/or packaging
process.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
  • Loading branch information
Julien Thierry committed Aug 24, 2020
1 parent 1c9aefe commit 7484eb1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PREFIX ?= /usr/local

MANDIR = $(addprefix $(DESTDIR),$(PREFIX)/share/man/man8)
CONFDIR = $(addprefix $(DESTDIR),/etc/dnf/plugins)

ifeq (, $(PYTHONSITES))
PYTHON = $(shell command -v python3)
ifeq (, $(PYTHON))
$(error "No python3 installation found.")
endif

PY_MAJOR = $(basename $(lastword $(shell $(PYTHON) --version)))
PYTHON_PREFIX = $(dir $(subst /bin/,/bin,$(dir $(PYTHON))))

PYTHONSITES = $(addsuffix lib/python$(PY_MAJOR)/site-packages,$(PYTHON_PREFIX))
endif

DNFPLUGINDIR = $(addprefix $(DESTDIR),$(PYTHONSITES)/dnf-plugins)

TARGETS = kpatch.py conf/kpatch.conf man/dnf.kpatch.8.gz

all: $(TARGETS)

install: $(TARGETS)
install -d $(MANDIR)
install man/dnf.kpatch.8.gz $(MANDIR)
install -d $(CONFDIR)
install conf/kpatch.conf $(CONFDIR)
install -d $(DNFPLUGINDIR)
install kpatch.py $(DNFPLUGINDIR)

%.gz: %
gzip --keep $^

0 comments on commit 7484eb1

Please sign in to comment.