mirror of
https://github.com/dynup/kpatch
synced 2024-12-20 12:20:02 +00:00
8b1ae48d7c
Right now, the makefile has one target, create-diff-object, which contains all the source/headers as one long list and all the source files compiled in one command to make create-diff-object. This doesn't scale well and doesn't accurately portray the dependencies of each object that contribute to the final binary. This commit renames create-diff-object.c to main.c so that it can be compiled and linked seperately and cleanly in Make and autogenerates dependencies for each .o. This should make it easier to add additional object files, or refactor the very large main.o into seperate object file, later.
32 lines
662 B
Makefile
32 lines
662 B
Makefile
include ../Makefile.inc
|
|
|
|
CFLAGS += -I../kmod/patch -Iinsn -Wall -g
|
|
LDFLAGS = -lelf
|
|
|
|
TARGETS = create-diff-object
|
|
OBJS = create-diff-object.o lookup.o insn/insn.o insn/inat.o
|
|
SOURCES = create-diff-object.c lookup.c insn/insn.c insn/inat.c
|
|
|
|
all: $(TARGETS)
|
|
|
|
-include $(SOURCES:.c=.d)
|
|
|
|
%.o : %.c
|
|
$(CC) -MMD -MP $(CFLAGS) -c -o $@ $<
|
|
|
|
create-diff-object: $(OBJS)
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
|
|
|
install: all
|
|
$(INSTALL) -d $(LIBEXECDIR)
|
|
$(INSTALL) $(TARGETS) kpatch-gcc $(LIBEXECDIR)
|
|
$(INSTALL) -d $(BINDIR)
|
|
$(INSTALL) kpatch-build $(BINDIR)
|
|
|
|
uninstall:
|
|
$(RM) -R $(LIBEXECDIR)
|
|
$(RM) $(BINDIR)/kpatch-build
|
|
|
|
clean:
|
|
$(RM) $(TARGETS) $(OBJS) *.d insn/*.d
|