-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 808 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
.PHONY : clean
CPPFLAGS= -fPIC -g -I$(LIBUSERFAULTFD_INCDIR) -static
LDFLAGS= -shared
INCDIR=/usr/include
LIBDIR=/usr/lib
LIBUSERFAULTFD_NAME=libuserfaultfd.so
LIBUSERFAULTFD_SRCDIR=./src
LIBUSERFAULTFD_INCDIR=./inc
LIBUSERFAULTFD_LIBDIR=./lib
SOURCES = $(shell echo $(LIBUSERFAULTFD_SRCDIR)/*.c)
HEADERS = $(shell echo $(LIBUSERFAULTFD_INCDIR)/*.h)
OBJECTS=$(SOURCES:.c=.o)
TARGET=$(LIBUSERFAULTFD_LIBDIR)/$(LIBUSERFAULTFD_NAME)
all: $(TARGET)
clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: install
install: $(TARGET)
mkdir -p $(LIBDIR) $(INCDIR)
cp $(TARGET) $(LIBDIR)/$(LIBUSERAULTFD_NAME)
cp $(HEADERS) $(INCDIR)
.PHONY: uninstall
uninstall: $(TARGET)
rm -f $(LIBDIR)/$(LIBUSERFAULTFD_NAME)
$(TARGET) : $(OBJECTS)
mkdir -p $(LIBUSERFAULTFD_LIBDIR)
$(CC) $(CFLAGS) $(OBJECTS) -o $@ $(LDFLAGS)