-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (42 loc) · 1.73 KB
/
Makefile
File metadata and controls
59 lines (42 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
prefix ?= /usr/local
libdir ?= $(prefix)/lib
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)
PLUGINDIR := $(abspath $(DESTDIR)/$(libdir)/slurm)
CONFDIR := $(abspath $(DESTDIR)/$(datadir)/pyxis)
PYXIS_VER ?= 0.23.0
PLUGIN := spank_pyxis.so
CONF := pyxis.conf
.PHONY: all install uninstall clean deb rpm
CPPFLAGS := -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DPYXIS_VERSION=\"$(PYXIS_VER)\" $(CPPFLAGS)
CFLAGS := -std=gnu11 -O2 -g -Wall -Wunused-variable -fstack-protector-strong -fpic $(CFLAGS)
LDFLAGS := -Wl,-znoexecstack -Wl,-zrelro -Wl,-znow $(LDFLAGS)
C_SRCS := common.c args.c pyxis_slurmstepd.c pyxis_slurmd.c pyxis_srun.c pyxis_alloc.c pyxis_dispatch.c config.c enroot.c importer.c
C_OBJS := $(C_SRCS:.c=.o)
DEPS := $(C_OBJS:%.o=%.d)
all: $(PLUGIN)
$(C_OBJS): %.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $*.d -c $<
$(PLUGIN): $(C_OBJS)
$(CC) -shared $(LDFLAGS) -o $@ spank_pyxis.lds $^
strip --strip-unneeded -R .comment $@
install: all
install -d -m 755 $(PLUGINDIR)
install -m 644 $(PLUGIN) $(PLUGINDIR)
install -d -m 755 $(CONFDIR)
echo 'required $(libdir)/slurm/$(PLUGIN)' | install -m 644 /dev/stdin $(CONFDIR)/$(CONF)
uninstall:
$(RM) $(PLUGINDIR)/$(PLUGIN)
$(RM) $(CONFDIR)/$(CONF)
clean:
rm -rf $(C_OBJS) $(DEPS) $(PLUGIN)
orig: clean
tar -caf ../nvslurm-plugin-pyxis_$(PYXIS_VER).orig.tar.xz --owner=root --group=root --exclude=.git .
deb: clean
debuild -us -uc -G -i -tc
rpm: clean
mkdir -p rpm/SOURCES
tar -caf rpm/SOURCES/nvslurm-plugin-pyxis-$(PYXIS_VER).tar.xz --transform='s,^.,nvslurm-plugin-pyxis-$(PYXIS_VER),' --exclude=rpm --exclude=.git .
rpmbuild --clean -ba -D"_topdir $(CURDIR)/rpm" -D"PYXIS_VER $(PYXIS_VER)" pyxis.spec
$(RM) -r $(addprefix rpm/, BUILDROOT BUILD SOURCES)
-include $(DEPS)