2014-02-13 16:04:35 +00:00
|
|
|
include ../Makefile.inc
|
2014-02-13 03:53:05 +00:00
|
|
|
|
2020-01-20 16:28:53 +00:00
|
|
|
CFLAGS += -MMD -MP -I../kmod/patch -Iinsn -Wall -Wsign-compare \
|
|
|
|
-Wconversion -Wno-sign-conversion -g -Werror
|
2017-08-22 01:18:41 +00:00
|
|
|
LDLIBS = -lelf
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2017-01-23 20:43:34 +00:00
|
|
|
TARGETS = create-diff-object create-klp-module create-kpatch-module
|
2016-07-12 19:59:43 +00:00
|
|
|
SOURCES = create-diff-object.c kpatch-elf.c \
|
2017-01-23 20:43:31 +00:00
|
|
|
create-klp-module.c \
|
2017-01-23 20:43:34 +00:00
|
|
|
create-kpatch-module.c \
|
2017-07-10 03:44:12 +00:00
|
|
|
create-kpatch-module.c lookup.c
|
|
|
|
|
|
|
|
SOURCES += insn/insn.c insn/inat.c
|
2017-11-09 18:48:30 +00:00
|
|
|
INSN = insn/insn.o insn/inat.o
|
2020-01-23 07:22:12 +00:00
|
|
|
insn/%.o: CFLAGS := $(filter-out -Wconversion, $(CFLAGS))
|
2022-01-21 17:02:20 +00:00
|
|
|
ifeq ($(ARCH),ppc64le)
|
2017-11-09 18:48:30 +00:00
|
|
|
SOURCES += gcc-plugins/ppc64le-plugin.c
|
|
|
|
PLUGIN = gcc-plugins/ppc64le-plugin.so
|
|
|
|
TARGETS += $(PLUGIN)
|
2022-01-12 13:50:59 +00:00
|
|
|
GCC_PLUGINS_DIR := $(shell $(CROSS_COMPILE)gcc -print-file-name=plugin)
|
2020-01-23 07:22:12 +00:00
|
|
|
PLUGIN_CFLAGS := $(filter-out -Wconversion, $(CFLAGS))
|
|
|
|
PLUGIN_CFLAGS += -shared -I$(GCC_PLUGINS_DIR)/include \
|
2017-11-09 18:48:30 +00:00
|
|
|
-Igcc-plugins -fPIC -fno-rtti -O2 -Wall
|
2022-03-29 08:21:07 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(filter $(ARCH),s390x x86_64 ppc64le),)
|
2020-07-20 12:39:55 +00:00
|
|
|
$(error Unsupported architecture ${ARCH}, check https://github.com/dynup/kpatch/#supported-architectures)
|
2017-07-10 03:44:12 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2014-02-13 16:04:35 +00:00
|
|
|
all: $(TARGETS)
|
|
|
|
|
2014-09-23 14:45:04 +00:00
|
|
|
-include $(SOURCES:.c=.d)
|
|
|
|
|
2017-11-09 18:48:30 +00:00
|
|
|
create-diff-object: create-diff-object.o kpatch-elf.o lookup.o $(INSN)
|
2022-05-11 23:25:13 +00:00
|
|
|
create-klp-module: create-klp-module.o kpatch-elf.o $(INSN)
|
|
|
|
create-kpatch-module: create-kpatch-module.o kpatch-elf.o $(INSN)
|
2017-01-23 20:43:31 +00:00
|
|
|
|
2017-11-09 18:48:30 +00:00
|
|
|
$(PLUGIN): gcc-plugins/ppc64le-plugin.c
|
|
|
|
g++ $(PLUGIN_CFLAGS) $< -o $@
|
|
|
|
|
2014-02-13 16:04:35 +00:00
|
|
|
install: all
|
|
|
|
$(INSTALL) -d $(LIBEXECDIR)
|
2021-01-27 10:41:49 +00:00
|
|
|
$(INSTALL) $(TARGETS) kpatch-cc $(LIBEXECDIR)
|
2014-03-10 14:24:40 +00:00
|
|
|
$(INSTALL) -d $(BINDIR)
|
|
|
|
$(INSTALL) kpatch-build $(BINDIR)
|
2014-02-11 16:25:48 +00:00
|
|
|
|
2014-03-20 14:29:06 +00:00
|
|
|
uninstall:
|
|
|
|
$(RM) -R $(LIBEXECDIR)
|
|
|
|
$(RM) $(BINDIR)/kpatch-build
|
|
|
|
|
2014-02-11 16:25:48 +00:00
|
|
|
clean:
|
2017-11-09 18:48:30 +00:00
|
|
|
$(RM) $(TARGETS) *.{o,d} insn/*.{o,d} gcc-plugins/*.{so,d}
|