-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
41 lines (30 loc) · 942 Bytes
/
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
CFLAGS := -m64 -std=gnu99 -O2 -g -pthread -D_GNU_SOURCE -Wall
LDFLAGS := -lm
EXEC = lnvm
INSTALL ?= install
DESTDIR =
PREFIX ?= /usr/local
SBINDIR = $(PREFIX)/sbin
# For the uapi header file we priorize this way:
# 1. Use /usr/src/$(uname -r)/include/uapi/linux/lightnvm.h
# 2. Use ./linux/lightnvm.h
ifneq (,$(wildcard /usr/src/linux-headers-$(shell uname -r)/include/uapi/linux/lightnvm.h))
LIGHTNVM_HEADER = /usr/src/linux-headers-$(shell uname -r)/include/uapi/linux/lightnvm.h
else
LIGHTNVM_HEADER = ./linux/lightnvm.h
endif
default: $(EXEC)
lnvm: lnvm.c $(LIGHTNVM_HEADER)
$(CC) $(CFLAGS) lnvm.c $(LDFLAGS) -o $(EXEC)
doc: $(EXEC)
$(MAKE) -C Documentation
all: lnvm doc
clean:
rm -f $(EXEC) *.o *~ a.out
$(MAKE) -C Documentation clean
clobber: clean
install-bin: default
$(INSTALL) -d $(DESTDIR)$(SBINDIR)
$(INSTALL) -m 755 lnvm $(DESTDIR)$(SBINDIR)
install: install-bin
.PHONY: default all doc clean clobber install