-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
41 lines (32 loc) · 930 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
MAJOR = 0
MINOR = 0
MICRO = 0
SHLIB = libglob.so.$(MAJOR).$(MINOR).$(MICRO)
OBJS = glob.o
PREFIX ?= /usr/local
LIBDIR = $(PREFIX)/lib
INCDIR = $(PREFIX)/include/libglob
.PHONY: all install uninstall clean
all: libglob.so libglob.a
$(OBJS): %.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
libglob.so: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -shared -Wl,-soname,libglob.so.$(MAJOR) -o $(SHLIB)
@-ln -sf $(SHLIB) libglob.so.$(MAJOR)
@-ln -sf $(SHLIB) libglob.so
libglob.a: $(OBJS)
$(AR) rcs $@ $^
ranlib $@
install: all
install -d $(DESTDIR)$(LIBDIR)
install -m 644 libglob.a $(DESTDIR)$(LIBDIR)
install -m 755 $(SHLIB) $(DESTDIR)$(LIBDIR)
cp -a libglob.so $(DESTDIR)$(LIBDIR)
cp -a libglob.so.$(MAJOR) $(DESTDIR)$(LIBDIR)
install -d $(DESTDIR)$(INCDIR)
install -m 644 glob.h $(DESTDIR)$(INCDIR)
uninstall:
-rm -rf $(DESTDIR)$(INCDIR)
-rm -f $(DESTDIR)$(LIBDIR)/libglob.*
clean:
-rm -f libglob* $(OBJS)