2021-12-15 14:18:02 -05:00
|
|
|
PLUGIN_NAME := amdgpu_plugin
|
|
|
|
PLUGIN_SOBJ := amdgpu_plugin.so
|
2021-07-15 01:34:08 -04:00
|
|
|
|
2021-09-29 08:26:04 -04:00
|
|
|
|
2022-05-15 17:08:18 +01:00
|
|
|
PLUGIN_INCLUDE := -iquote../../include
|
2021-09-29 08:26:04 -04:00
|
|
|
PLUGIN_INCLUDE += -iquote../../criu/include
|
|
|
|
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
|
|
|
|
PLUGIN_INCLUDE += -iquote../../
|
|
|
|
|
|
|
|
COMPEL := ../../compel/compel-host
|
|
|
|
LIBDRM_INC := -I/usr/include/libdrm
|
2021-05-18 12:15:48 -04:00
|
|
|
DEPS_OK := amdgpu_plugin.so amdgpu_plugin_test
|
2021-12-15 14:18:02 -05:00
|
|
|
DEPS_NOK := ;
|
|
|
|
|
2022-11-09 11:01:29 +00:00
|
|
|
__nmk_dir ?= ../../scripts/nmk/scripts/
|
2021-12-15 14:18:02 -05:00
|
|
|
include $(__nmk_dir)msg.mk
|
|
|
|
|
2024-09-26 10:59:32 +01:00
|
|
|
PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC
|
2021-06-25 11:29:17 -04:00
|
|
|
PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu
|
2021-12-15 14:18:02 -05:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_AMDGPU),y)
|
|
|
|
all: $(DEPS_OK)
|
|
|
|
else
|
|
|
|
all: $(DEPS_NOK)
|
|
|
|
endif
|
|
|
|
|
|
|
|
criu-amdgpu.pb-c.c: criu-amdgpu.proto
|
|
|
|
protoc-c --proto_path=. --c_out=. criu-amdgpu.proto
|
|
|
|
|
2025-01-15 06:38:27 +00:00
|
|
|
amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_drm.c amdgpu_plugin_topology.c amdgpu_plugin_util.c criu-amdgpu.pb-c.c amdgpu_socket_utils.c
|
2021-09-29 08:26:04 -04:00
|
|
|
$(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS) $(LIBDRM_INC)
|
2021-12-15 14:18:02 -05:00
|
|
|
|
|
|
|
amdgpu_plugin_clean:
|
|
|
|
$(call msg-clean, $@)
|
|
|
|
$(Q) $(RM) amdgpu_plugin.so criu-amdgpu.pb-c*
|
|
|
|
.PHONY: amdgpu_plugin_clean
|
2021-05-18 12:15:48 -04:00
|
|
|
|
|
|
|
test_topology_remap: amdgpu_plugin_topology.c tests/test_topology_remap.c
|
|
|
|
$(CC) $^ -o $@ -DCOMPILE_TESTS $(PLUGIN_INCLUDE) -I .
|
|
|
|
|
|
|
|
amdgpu_plugin_test: test_topology_remap
|
|
|
|
.PHONY: amdgpu_plugin_test
|
|
|
|
|
|
|
|
amdgpu_plugin_test_clean:
|
|
|
|
$(Q) $(RM) test_topology_remap
|
|
|
|
.PHONY: amdgpu_plugin_test_clean
|
|
|
|
|
|
|
|
clean: amdgpu_plugin_clean amdgpu_plugin_test_clean
|
2021-12-15 14:18:02 -05:00
|
|
|
|
|
|
|
mrproper: clean
|
2021-07-15 01:34:08 -04:00
|
|
|
|
|
|
|
install:
|
2021-12-15 14:18:02 -05:00
|
|
|
ifeq ($(CONFIG_AMDGPU),y)
|
2022-05-08 11:07:25 +01:00
|
|
|
$(Q) mkdir -p $(DESTDIR)$(PLUGINDIR)
|
2021-12-15 14:18:02 -05:00
|
|
|
$(E) " INSTALL " $(PLUGIN_NAME)
|
2024-07-10 03:30:34 +01:00
|
|
|
$(Q) install -m 755 $(PLUGIN_SOBJ) $(DESTDIR)$(PLUGINDIR)
|
2021-12-15 14:18:02 -05:00
|
|
|
endif
|
|
|
|
.PHONY: install
|
2021-07-15 01:34:08 -04:00
|
|
|
|
|
|
|
uninstall:
|
2021-12-15 14:18:02 -05:00
|
|
|
ifeq ($(CONFIG_AMDGPU),y)
|
|
|
|
$(E) " UNINSTALL" $(PLUGIN_NAME)
|
2022-05-08 11:07:25 +01:00
|
|
|
$(Q) $(RM) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN_SOBJ)
|
2021-12-15 14:18:02 -05:00
|
|
|
endif
|
|
|
|
.PHONY: uninstall
|