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-12-15 14:18:02 -05:00
|
|
|
PLUGIN_INC := ../../../criu/include
|
|
|
|
PLUGIN_INC_EXTRA := ../../criu/include
|
|
|
|
PLUGIN_INCLUDE := -iquote$(PLUGIN_INC) -iquote$(PLUGIN_INC_EXTRA)
|
|
|
|
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 := ;
|
|
|
|
|
|
|
|
include $(__nmk_dir)msg.mk
|
|
|
|
|
|
|
|
CC := gcc
|
|
|
|
PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC
|
2021-06-10 15:07:13 -04:00
|
|
|
PLUGIN_LDFLAGS := -lpthread -lrt
|
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
|
|
|
|
|
2022-02-14 12:00:58 -05:00
|
|
|
amdgpu_plugin.so: amdgpu_plugin.c amdgpu_plugin_topology.c criu-amdgpu.pb-c.c
|
2021-12-22 02:48:45 -05:00
|
|
|
$(CC) $(PLUGIN_CFLAGS) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS)
|
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:
|
|
|
|
$(Q) mkdir -p $(PLUGINDIR)
|
2021-12-15 14:18:02 -05:00
|
|
|
ifeq ($(CONFIG_AMDGPU),y)
|
|
|
|
$(E) " INSTALL " $(PLUGIN_NAME)
|
|
|
|
$(Q) install -m 644 $(PLUGIN_SOBJ) $(PLUGINDIR)
|
|
|
|
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)
|
|
|
|
$(Q) $(RM) $(PLUGINDIR)/$(PLUGIN_SOBJ)
|
|
|
|
endif
|
|
|
|
.PHONY: uninstall
|