summaryrefslogtreecommitdiff
path: root/databases/credis/files/patch-Makefile
blob: e60106725ac270b338a80840ff44e7cfc2b0dfbc (plain) (blame)
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
--- Makefile.orig	2010-08-27 04:57:25.000000000 -0400
+++ Makefile	2011-02-02 11:38:11.000000000 -0500
@@ -1,7 +1,21 @@
-CFLAGS = -g -O2 -Wall
-LDFLAGS =
+CFLAGS ?= -g -O2 -Wall
+LDFLAGS ?=
 #CPPFLAGS = -DPRINTDEBUG
 
+VER_MAJOR = 0
+VER_MINOR = 2
+VER_PATCH = 3
+VER=$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
+
+prefix ?= /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+DESTDIR ?=
+INSTALL ?= /usr/bin/install -c
+MKDIR_P ?= /bin/mkdir -p
+CP ?= /bin/cp -f
+LN ?= /bin/ln -fs
+
 # build shared lib under OS X or Linux
 OS = $(shell uname -s)
 ifeq ($(OS),Darwin)
@@ -22,12 +36,19 @@
 	$(AR) -cvq $@ $^
 
 libcredis.so: credis.o
-	$(CC) $(SHAREDLIB_LINK_OPTIONS)$@ -o $@ $^
+	$(CC) $(SHAREDLIB_LINK_OPTIONS)$@.$(VER_MAJOR) -o $@.$(VER) $^
+	$(LN) $@.$(VER) $@.$(VER_MAJOR)
+	$(LN) $@.$(VER_MAJOR) $@
 
 credis.o: credis.c credis.h Makefile
 	$(CC) -c -fPIC $(CFLAGS) $(CPPFLAGS) -o $@ credis.c
 
-install:
-	@echo "Installing library (to be done)"
+install: all installdirs
+	$(INSTALL) -m644 *.h $(DESTDIR)$(includedir)
+	$(CP) *.so* *.a $(DESTDIR)$(libdir)
+
+installdirs:
+	$(MKDIR_P) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+
 clean:
-	rm -f *.o *~ $(TARGETS)
+	rm -f *.o *~ *.so* $(TARGETS)