Merge pull request #575 from arges/packaging

Changes to make packaging easier
This commit is contained in:
Jessica Yu 2016-02-10 12:12:45 -08:00
commit 08f55afa0a
4 changed files with 14 additions and 3 deletions

View File

@ -5,13 +5,15 @@ INSTALL = /usr/bin/install
PREFIX ?= /usr/local
LIBDIR ?= lib
LIBEXEC ?= libexec
BINDIR = $(DESTDIR)$(PREFIX)/bin
SBINDIR = $(DESTDIR)$(PREFIX)/sbin
MODULESDIR = $(DESTDIR)$(PREFIX)/$(LIBDIR)/kpatch
LIBEXECDIR = $(DESTDIR)$(PREFIX)/libexec/kpatch
LIBEXECDIR = $(DESTDIR)$(PREFIX)/$(LIBEXEC)/kpatch
DATADIR = $(DESTDIR)$(PREFIX)/share/kpatch
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1
SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system
BUILDMOD ?= yes
.PHONY: all install clean
.DEFAULT: all

View File

@ -1,18 +1,26 @@
include ../Makefile.inc
all: clean
ifeq ($(BUILDMOD),yes)
$(MAKE) -C core
endif
install:
ifeq ($(BUILDMOD),yes)
$(INSTALL) -d $(MODULESDIR)/$(shell uname -r)
$(INSTALL) -m 644 core/kpatch.ko $(MODULESDIR)/$(shell uname -r)
$(INSTALL) -m 644 core/Module.symvers $(MODULESDIR)/$(shell uname -r)
endif
$(INSTALL) -d $(DATADIR)/patch
$(INSTALL) -m 644 patch/* $(DATADIR)/patch
uninstall:
ifeq ($(BUILDMOD),yes)
$(RM) -R $(MODULESDIR)
endif
$(RM) -R $(DATADIR)
clean:
ifeq ($(BUILDMOD),yes)
$(MAKE) -C core clean
endif

View File

@ -1,9 +1,10 @@
# make rules
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
KERNELRELEASE := $(lastword $(subst /, , $(dir $(KPATCH_BUILD))))
THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(wildcard $(KPATCH_BUILD)),)
$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(shell uname -r) RPM or linux-image-$(shell uname -r)-dbg DEB.)
$(error $(KPATCH_BUILD) doesn\'t exist. Try installing the kernel-devel-$(KERNELRELEASE) RPM or linux-headers-$(KERNELRELEASE) DEB.)
endif
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR)

View File

@ -1,7 +1,7 @@
include ../Makefile.inc
CFLAGS += -I../kmod/patch -Iinsn -Wall -g -Werror
LDFLAGS = -lelf
LDFLAGS += -lelf
TARGETS = create-diff-object
OBJS = create-diff-object.o lookup.o insn/insn.o insn/inat.o