2014-02-13 16:04:35 +00:00
|
|
|
include ../Makefile.inc
|
2014-02-13 03:53:05 +00:00
|
|
|
|
2015-10-27 00:56:11 +00:00
|
|
|
CFLAGS += -I../kmod/patch -Iinsn -Wall -g -Werror
|
2016-01-11 20:21:38 +00:00
|
|
|
LDFLAGS += -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
|
|
|
|
|
|
|
|
ifeq ($(ARCH),x86_64)
|
|
|
|
SOURCES += insn/insn.c insn/inat.c
|
|
|
|
INSN = insn/insn.o insn/inat.o
|
|
|
|
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)
|
|
|
|
|
|
|
|
%.o : %.c
|
|
|
|
$(CC) -MMD -MP $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2017-01-23 20:43:31 +00:00
|
|
|
create-diff-object: create-diff-object.o kpatch-elf.o \
|
2017-07-10 03:44:12 +00:00
|
|
|
lookup.o $(INSN)
|
2017-01-23 20:43:31 +00:00
|
|
|
create-klp-module: create-klp-module.o kpatch-elf.o
|
2017-01-23 20:43:34 +00:00
|
|
|
create-kpatch-module: create-kpatch-module.o kpatch-elf.o
|
2017-01-23 20:43:31 +00:00
|
|
|
|
|
|
|
$(TARGETS):
|
2014-09-23 14:45:04 +00:00
|
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
2014-05-06 22:15:38 +00:00
|
|
|
|
2014-02-13 16:04:35 +00:00
|
|
|
install: all
|
|
|
|
$(INSTALL) -d $(LIBEXECDIR)
|
2014-08-07 20:33:31 +00:00
|
|
|
$(INSTALL) $(TARGETS) kpatch-gcc $(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-01-23 20:43:31 +00:00
|
|
|
$(RM) $(TARGETS) *.o *.d insn/*.d
|