-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
48 lines (37 loc) · 1.08 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
CC = gcc
CFLAGS = -Wall -Wcast-align -Wcast-qual -Wimplicit -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow
ifndef PREFIX
PREFIX = /usr/local
endif
ifndef INCLUDEDIR
INCLUDEDIR = $(PREFIX)/include
endif
ifndef LIBDIR
LIBDIR = $(PREFIX)/lib
endif
include VERSION
SHAREDLIB=libcrc32trim.so
SHAREDLIBV=libcrc32trim.so.$(LIBCRC32TRIM_VERSION)
SHAREDLIBM=libcrc32trim.so.$(firstword $(subst ., ,$(LIBCRC32TRIM_VERSION)))
all: $(SHAREDLIBV)
%.o: %.c
$(CC) $(CFLAGS) -fpic -c -o $@ $<
$(SHAREDLIBV): crc32trim.o
$(CC) -shared -o $(SHAREDLIBV) crc32trim.o
.PHONY: clean
clean:
rm -f crc32trim.o $(SHAREDLIBV)
.PHONY: install
install: $(SHAREDLIBV)
mkdir -p $(DESTDIR)$(LIBDIR)
mkdir -p $(DESTDIR)$(INCLUDEDIR)
install $(SHAREDLIBV) $(DESTDIR)$(LIBDIR)/
ln -s $(SHAREDLIBV) $(DESTDIR)$(LIBDIR)/$(SHAREDLIB)
ln -s $(SHAREDLIBV) $(DESTDIR)$(LIBDIR)/$(SHAREDLIBM)
cp crc32trim.h $(DESTDIR)$(INCLUDEDIR)/
.PHONY: uninstall
uninstall:
rm $(DESTDIR)$(LIBDIR)/$(SHAREDLIB)
rm $(DESTDIR)$(LIBDIR)/$(SHAREDLIBM)
rm $(DESTDIR)$(LIBDIR)/$(SHAREDLIBV)
rm $(DESTDIR)$(INCLUDEDIR)/crc32trim.h