-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
45 lines (33 loc) · 1.28 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
CFLAGS=-fPIC -DPIC -std=gnu99 -ggdb -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wall -Wextra -Wshadow -Werror -O2 -D_FORTIFY_SOURCE=2
LIB_DESTDIR=$(DESTDIR)/usr/lib64
INC_DESTDIR=$(DESTDIR)/usr/include/castle
EXE_DESTDIR=$(DESTDIR)/usr/sbin
SONAME=libcastle.so.1
CASTLE_IOCTLS_EXENAME=castle_ioctl_cmd
all: $(SONAME) $(CASTLE_IOCTLS_EXENAME)
%.o: %.c *.h
gcc -pthread -c -o $@ $< $(CFLAGS)
$(SONAME): castle_front.o castle_ioctl.o castle_convenience.o castle_print.o castle_utils.o
gcc -pthread -shared -Wl,-Bsymbolic -Wl,-soname,$(SONAME) -Wl,--warn-common -Wl,--fatal-warnings -Wl,--version-script=versions -o $@ $^ $(CFLAGS)
$(CASTLE_IOCTLS_EXENAME): castle_front.o castle_ioctl.o castle_convenience.o castle_print.o castle_utils.o
gcc -pthread -o $@ $^ $(CFLAGS)
install: $(SONAME) $(CASTLE_IOCTLS_EXENAME)
mkdir -p $(LIB_DESTDIR)
install $(SONAME) $(LIB_DESTDIR)
ln -sf $(SONAME) $(LIB_DESTDIR)/libcastle.so
if [ -z "$(DONT_RUN_LDCONFIG)" ]; then \
/sbin/ldconfig; \
fi
mkdir -p $(INC_DESTDIR)
install castle_public.h $(INC_DESTDIR)
install castle.h $(INC_DESTDIR)
mkdir -p $(EXE_DESTDIR)
install $(CASTLE_IOCTLS_EXENAME) $(EXE_DESTDIR)
.PHONY: tags
tags:
ctags *.c *.h
.PHONY: cscope
cscope:
cscope -b -q *.c *.h
clean:
rm -rf *.o *.so* cscope*