criu/compel/plugins/Makefile
Dmitry Safonov 25f6d4f72f build: Remove SRCARCH
SRCARCH is always equal ARCH. There are no rules when to use one or
another and architectures may forget to set one of them up.

No need for a second variable meaning the same and confusing people.
Remove it completely.

Self-correction [after some debug]: SRCARCH was different in one place:
zdtm Makefile by some unintentional mistake:
> ifeq ($(ARCH),arm64)
>         ARCH		?= aarch64
>         SRCARCH	?= aarch64
> endif

That meant to be "ARCH := aarch64" because "?=" would never work inside
that ifeq. Fix up this part of mess too.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-02-04 12:39:04 -08:00

102 lines
3.1 KiB
Makefile

CFLAGS := $(filter-out -pg $(CFLAGS-GCOV) $(CFLAGS-ASAN),$(CFLAGS))
CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
CFLAGS += -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=0
PLUGIN_ARCH_DIR := compel/arch/$(ARCH)/plugins
#
# CFLAGS, ASFLAGS, LDFLAGS
# Required for pie code
ccflags-y += $(CFLAGS_PIE)
# UAPI inclusion, referred as <compel/...>
ccflags-y += -I compel/include/uapi
asflags-y += -I compel/include/uapi
# General compel includes
ccflags-y += -iquote compel/include
ccflags-y += -fpie -fno-stack-protector
# General compel/plugins includes
ccflags-y += -iquote $(obj)/include
asflags-y += -iquote $(obj)/include
# Arch compel/plugins includes
ccflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(PLUGIN_ARCH_DIR)/include
asflags-y += -iquote $(PLUGIN_ARCH_DIR)
# General flags for assembly
asflags-y += -fpie -Wstrict-prototypes
asflags-y += -nostdlib -fomit-frame-pointer
asflags-y += -fno-stack-protector
ldflags-y += -z noexecstack
#
# Shmem plugin
target += shmem
shmem-lib-y += shmem/shmem.o
#
# STD plugin
target += std
std-lib-y += std/std.o
std-lib-y += std/fds.o
std-lib-y += std/log.o
std-lib-y += std/string.o
std-lib-y += std/infect.o
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/parasite-head.o
#
# FDS plugin
target += fds
fds-lib-y += fds/fds.o
ifeq ($(ARCH),x86)
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
endif
ifeq ($(ARCH),ppc64)
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
std-lib-y += ./$(PLUGIN_ARCH_DIR)/std/memcmp.o
endif
include ./$(PLUGIN_ARCH_DIR)/std/syscalls/Makefile.syscalls
define syscall-priority
$(addprefix $(obj)/,$($(1):%.o=%.d)): | $($(2))
$(addprefix $(obj)/,$($(1):%.o=%.i)): | $($(2))
$(addprefix $(obj)/,$($(1):%.o=%.s)): | $($(2))
$(addprefix $(obj)/,$($(1))): | $($(2))
endef
#
# Almost all plugins depen on syscall headers
# and definitions so we have to order their
# generation manually.
$(foreach t,$(target),$(eval $(call syscall-priority,$(t)-lib-y,std-headers-deps)))
#
# FIXME syscall-types.h should be setup earlier
#
install: compel/plugins/std.lib.a compel/plugins/fds.lib.a
$(E) " INSTALL " compel plugins
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/
$(Q) install -m 0644 $^ $(DESTDIR)$(LIBEXECDIR)/compel/
$(Q) mkdir -p $(DESTDIR)$(LIBEXECDIR)/compel/scripts
$(Q) install -m 0644 compel/arch/$(ARCH)/scripts/compel-pack.lds.S $(DESTDIR)$(LIBEXECDIR)/compel/scripts
$(E) " INSTALL " compel plugins uapi
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm
$(Q) cp -fL compel/plugins/include/uapi/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/
$(Q) cp -fL compel/plugins/include/uapi/std/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/
$(Q) cp -fL compel/plugins/include/uapi/std/asm/*.h $(DESTDIR)$(INCLUDEDIR)/compel/plugins/std/asm/
.PHONY: install
uninstall:
$(E) " UNINSTALL" compel plugins
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/,*.lib.a)
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBEXECDIR)/compel/scripts/,compel-pack.lds.S)
$(E) " UNINSTALL" compel and plugins uapi
$(Q) $(RM) -rf $(addprefix $(DESTDIR)$(INCLUDEDIR)/,compel/plugins)
.PHONY: uninstall