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 PREFIX ?= /usr/local
LIBDIR ?= lib LIBDIR ?= lib
LIBEXEC ?= libexec
BINDIR = $(DESTDIR)$(PREFIX)/bin BINDIR = $(DESTDIR)$(PREFIX)/bin
SBINDIR = $(DESTDIR)$(PREFIX)/sbin SBINDIR = $(DESTDIR)$(PREFIX)/sbin
MODULESDIR = $(DESTDIR)$(PREFIX)/$(LIBDIR)/kpatch MODULESDIR = $(DESTDIR)$(PREFIX)/$(LIBDIR)/kpatch
LIBEXECDIR = $(DESTDIR)$(PREFIX)/libexec/kpatch LIBEXECDIR = $(DESTDIR)$(PREFIX)/$(LIBEXEC)/kpatch
DATADIR = $(DESTDIR)$(PREFIX)/share/kpatch DATADIR = $(DESTDIR)$(PREFIX)/share/kpatch
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1 MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1
SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system SYSTEMDDIR = $(DESTDIR)$(PREFIX)/lib/systemd/system
BUILDMOD ?= yes
.PHONY: all install clean .PHONY: all install clean
.DEFAULT: all .DEFAULT: all

View File

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

View File

@ -1,9 +1,10 @@
# make rules # make rules
KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build KPATCH_BUILD ?= /lib/modules/$(shell uname -r)/build
KERNELRELEASE := $(lastword $(subst /, , $(dir $(KPATCH_BUILD))))
THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) THISDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
ifeq ($(wildcard $(KPATCH_BUILD)),) 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 endif
KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR) KPATCH_MAKE = $(MAKE) -C $(KPATCH_BUILD) M=$(THISDIR)

View File

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