This repository has been archived by the owner on Oct 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (51 loc) · 1.55 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.POSIX:
CONFIGFILE = config.mk
include $(CONFIGFILE)
OS = linux
# Linux: linux
# Mac OS: macos
# Windows: windows
include mk/$(OS).mk
LIB_MAJOR = 1
LIB_MINOR = 2
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
HDR = libclut.h
OBJ = libclut.o
LOBJ = $(OBJ:.o=.lo)
all: libclut.a libclut.$(LIBEXT) test
$(OBJ): $(HDR)
$(LOBJ): $(HDR)
.c.o:
$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
.c.lo:
$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)
test: test.o libclut.a
$(CC) -o $@ test.o libclut.a $(LDFLAGS)
libclut.$(LIBEXT): $(LOBJ)
$(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
libclut.a: $(OBJ)
-rm -f -- $@
$(AR) rc $@ $(OBJ)
$(AR) -s $@
check: test
./test
install: libclut.a libclut.$(LIBEXT)
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
cp -- libclut.a "$(DESTDIR)$(PREFIX)/lib"
cp -- libclut.so "$(DESTDIR)$(PREFIX)/lib/libclut.$(LIBMINOREXT)"
$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libclut.$(LIBMINOREXT)"
ln -sf -- "libclut.$(LIBMINOREXT)" "$(DESTDIR)$(PREFIX)/lib/libclut.$(LIBMAJOREXT)"
ln -sf -- "libclut.$(LIBMINOREXT)" "$(DESTDIR)$(PREFIX)/lib/libclut.$(LIBEXT)"
cp -- libclut.h "$(DESTDIR)$(PREFIX)/include"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.a"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(LIBEXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(LIBMAJOREXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libclut.so.$(LIBMINOREXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libclut.h"
clean:
-rm -f -- *.o *.a *.so *.lo *.su test
.SUFFIXES:
.SUFFIXES: .lo .o .c
.PHONY: all check install uninstall clean