-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (39 loc) · 1.18 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
AR = ar
RANLIB = ranlib
CFLAGS = -std=gnu89 -pedantic -Wall -O3
PREFIX = /usr
all: shared static
shared:
@echo ""
@echo "Building libsubstrings.so.0.2..."
$(CC) substrings.c -o libsubstrings.so.0.2 $(CFLAGS) -shared -Wl,-soname,libsubstrings.so.0 -nostdlib
ln -sf libsubstrings.so.0.2 libsubstrings.so.0
ln -sf libsubstrings.so.0.2 libsubstrings.so
static:
@echo ""
@echo "Building libsubstrings.a..."
$(CC) substrings.c -c $(CFLAGS)
$(AR) rc libsubstrings.a substrings.o
$(RANLIB) libsubstrings.a
install-hdr:
mkdir -p $(PREFIX)/include/substrings/
install -v -m 0644 substrings.h $(PREFIX)/include/substrings/
install-shared:
mkdir -p $(PREFIX)/lib/
install -v -m 0644 libsubstrings.so.0.2 $(PREFIX)/lib/
ln -sf libsubstrings.so.0.2 $(PREFIX)/lib/libsubstrings.so.0
ln -sf libsubstrings.so.0.2 $(PREFIX)/lib/libsubstrings.so
install-static:
mkdir -p $(PREFIX)/lib/
install -v -m 0644 libsubstrings.a $(PREFIX)/lib/
install-all: install-hdr install-shared install-static
install: install-all
uninstall:
rm -rvf $(PREFIX)/include/substrings
rm -vf $(PREFIX)/lib/libsubstrings.*
clean:
rm -vf libsubstrings.*
rm -vf substrings.o
rm -vf substrings.h.gch
distclean: clean