forked from LLNL/msr-safe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
92 lines (75 loc) · 3.1 KB
/
Makefile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright (c) 2011-2017 by Lawrence Livermore National Security, LLC.
# LLNL-CODE-645430
#
# Produced at Lawrence Livermore National Laboratory.
# Written by Marty McFadden, [email protected]
# Kathleen Shoga, [email protected]
# Barry Rountree, [email protected]
#
# All rights reserved.
#
# This file is part of msr-safe.
#
# msr-safe is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# msr-safe is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with msr-safe. If not, see <http://www.gnu.org/licenses/>.
#
# This material is based upon work supported by the U.S. Department of
# Energy's Lawrence Livermore National Laboratory. Office of Science, under
# Award number DE-AC52-07NA27344.
# Uncomment following line(s) to enable debug output from different
# portions of kernel module.
#
#CFLAGS_msr_whitelist.o := -DDEBUG
#CFLAGS_msr_entry.o := -DDEBUG
#CFLAGS_msr_batch.o := -DDEBUG
#CFLAGS_msr-smp.o := -DDEBUG
obj-m += msr-safe.o
msr-safe-objs := msr_entry.o msr_whitelist.o msr-smp.o msr_batch.o
all: msrsave/msrsave
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rm -f msrsave/msrsave.o msrsave/msrsave msrsave/msrsave_test msrsave/spank_msrsafe.o msrsave/libspank_msrsafe.so
check: msrsave/msrsave_test
msrsave/msrsave_test
msrsave/msrsave.o: msrsave/msrsave.c msrsave/msrsave.h
$(CC) $(CFLAGS) -fPIC -shared -c msrsave/msrsave.c -o $@
msrsave/msrsave_main.o: msrsave/msrsave_main.c msrsave/msrsave.h
msrsave/msrsave: msrsave/msrsave_main.o msrsave/msrsave.o
msrsave/msrsave_test.o: msrsave/msrsave_test.c msrsave/msrsave.h
msrsave/msrsave_test: msrsave/msrsave_test.o msrsave/msrsave.o
SLURM_CFLAGS ?= -I/usr/include -fPIC -shared
SLURM_LDFLAGS ?= -L/usr/lib64 -lslurm -shared
spank: msrsave/libspank_msrsafe.so
msrsave/spank_msrsafe.o: msrsave/spank_msrsafe.c
$(CC) $(CFLAGS) $(SLURM_CFLAGS) -c $^ -o $@
msrsave/libspank_msrsafe.so: msrsave/spank_msrsafe.o msrsave/msrsave.o
$(CC) $(LDFLAGS) $(SLURM_LDFLAGS) $^ -o $@
INSTALL ?= install
prefix ?= $(HOME)/build
exec_prefix ?= $(prefix)
sbindir ?= $(exec_prefix)/sbin
libdir ?= $(exec_preffix)/lib
datarootdir ?= $(prefix)/share
mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1
install: msrsave/msrsave msrsave/msrsave.1
$(INSTALL) -d $(DESTDIR)/$(sbindir)
$(INSTALL) msrsave/msrsave $(DESTDIR)/$(sbindir)
$(INSTALL) -d $(DESTDIR)/$(man1dir)
$(INSTALL) -m 644 msrsave/msrsave.1 $(DESTDIR)/$(man1dir)
install-spank: spank
$(INSTALL) -d $(DESTDIR)/$(libdir)/slurm
$(INSTALL) msrsave/libspank_msrsafe.so $(DESTDIR)/$(libdir)/slurm/libspank_msrsafe.so
.SUFFIXES: .c .o
.PHONY: all clean install spank install-spank