criu/plugins/cuda/Makefile
Radostin Stoyanov fcbadfbdbf plugins: set executable bit on .so files
For historical reasons, some tools like rpm [1] or ldd [2,3]
may expect the executable bit to be present for the correct
identification of shared libraries. The executable bit on .so
files is set by default by compilers (e.g., GCC). It is not
strictly necessary but primarily a convention.

[1] https://docs.fedoraproject.org/en-US/package-maintainers/CommonRpmlintIssues/#unstripped_binary_or_object
[2] https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/ldd.bash.in;h=d6b640df;hb=HEAD#l154

[3] $ sudo ldd /usr/lib/criu/*.so
/usr/lib/criu/amdgpu_plugin.so:
ldd: warning: you do not have execution permission for `/usr/lib/criu/amdgpu_plugin.so'
	linux-vdso.so.1 (0x00007fd0a2a3e000)
	libdrm.so.2 => /lib64/libdrm.so.2 (0x00007fd0a29eb000)
	libdrm_amdgpu.so.1 => /lib64/libdrm_amdgpu.so.1 (0x00007fd0a29de000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd0a27fc000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd0a2a40000)
/usr/lib/criu/cuda_plugin.so:
ldd: warning: you do not have execution permission for `/usr/lib/criu/cuda_plugin.so'
	linux-vdso.so.1 (0x00007f1806e13000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f1806c08000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1806e15000)

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
2024-09-11 16:02:11 -07:00

40 lines
968 B
Makefile

PLUGIN_NAME := cuda_plugin
PLUGIN_SOBJ := cuda_plugin.so
DEPS_CUDA := $(PLUGIN_SOBJ)
PLUGIN_INCLUDE := -iquote../../include
PLUGIN_INCLUDE += -iquote../../criu/include
PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/
PLUGIN_INCLUDE += -iquote../../
COMPEL := ../../compel/compel-host
PLUGIN_CFLAGS := -g -Wall -Werror -shared -nostartfiles -fPIC
__nmk_dir ?= ../../scripts/nmk/scripts/
include $(__nmk_dir)msg.mk
all: $(DEPS_CUDA)
cuda_plugin.so: cuda_plugin.c
$(call msg-gen, $@)
$(Q) $(CC) $(PLUGIN_CFLAGS) $(shell $(COMPEL) includes) $^ -o $@ $(PLUGIN_INCLUDE) $(PLUGIN_LDFLAGS)
clean:
$(call msg-clean, $@)
$(Q) $(RM) $(PLUGIN_SOBJ)
.PHONY: clean
mrproper: clean
install:
$(Q) mkdir -p $(DESTDIR)$(PLUGINDIR)
$(E) " INSTALL " $(PLUGIN_NAME)
$(Q) install -m 755 $(PLUGIN_SOBJ) $(DESTDIR)$(PLUGINDIR)
.PHONY: install
uninstall:
$(E) " UNINSTALL" $(PLUGIN_NAME)
$(Q) $(RM) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN_SOBJ)
.PHONY: uninstall