-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (80 loc) · 3.26 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
##
## Makefile for building and installing the suffix array libraries
##
## Copyright (C) 2015 Josh Marshall
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
##.major.minor.fix
#MAJOR -> features removed or other breaking API change
#MINOR -> API extension/addition
#FIX -> code correction
#VERSION = .$MAJOR.$MINOR.$FIX
MAJOR = .2
MINOR = .1
FIX = .1
CFLAGS_DEBUG = -ggdb -pipe -Wall -fstack-protector-all -fpic -D DEBUG -O0
CFLAGS = -pipe -march=native -fpic -Ofast
STATIC_LINK = ar rcs
STATIC_LINK_DEBUG = $(STATIC_LINK)
SHARED_LINK_COMMON = -shared -Wall -lc -march=native
SHARED_LINK = $(SHARED_LINK_COMMON) -Ofast
SHARED_LINK_DEBUG = $(SHARED_LINK_COMMON) -g
HEADERS = suffixarray.h
SOURCE = suffixarray.c
OBJECTS = suffixarray.o
OBJECTS_DEBUG = suffixarray-debug.o
STATICLIB = libsuffixarray.a
SHAREDLIB = libsuffixarray.so
STATICLIB_DEBUG = libsuffixarray-debug.a
SHAREDLIB_DEBUG = libsuffixarray-debug.so
##STANDARD BUILD########################################################
all : $(STATICLIB) $(SHAREDLIB)
$(STATICLIB) : $(OBJECTS)
$(STATIC_LINK) $@ $(OBJECTS)
$(SHAREDLIB) : $(OBJECTS)
gcc $(OBJECTS) $(SHARED_LINK) -o $@
$(OBJECTS) : $(SOURCE) $(HEADERS)
gcc -c $(CFLAGS) $< -o $@
##DEBUG#################################################################
debug : $(STATICLIB_DEBUG) $(STATICLIB)
mv $(STATICLIB_DEBUG) test/
mv $(STATICLIB) test/
cd test; make
$(STATICLIB_DEBUG) : $(OBJECTS_DEBUG)
$(STATIC_LINK_DEBUG) $(STATICLIB_DEBUG) $(OBJECTS_DEBUG)
$(OBJECTS_DEBUG) : $(SOURCE) $(HEADERS)
gcc -c $(CFLAGS_DEBUG) $< -o $@
##AUXILLARY FUNCTIONS###################################################
clean :
rm -f *.a *.so *.o
cd test; make clean
install : $(STATICLIB) $(SHAREDLIB)
install -C $(HEADERS) /usr/include/$(HEADERS)
install -C $(SHAREDLIB) /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR)$(FIX)
install -C $(STATICLIB) /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR)$(FIX)
ln -rsf /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR)$(FIX) /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR)
ln -rsf /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR) /usr/lib/$(SHAREDLIB)$(MAJOR)
ln -rsf /usr/lib/$(SHAREDLIB)$(MAJOR) /usr/lib/$(SHAREDLIB)
ln -rsf /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR)$(FIX) /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR)
ln -rsf /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR) /usr/lib/$(STATICLIB)$(MAJOR)
ln -rsf /usr/lib/$(STATICLIB)$(MAJOR) /usr/lib/$(STATICLIB)
uninstall :
rm -f /usr/include/$(HEADERS)
rm -f /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR)
rm -f /usr/lib/$(SHAREDLIB)$(MAJOR)$(MINOR)$(FIX)
rm -f /usr/lib/$(SHAREDLIB)$(MAJOR) /usr/lib/$(SHAREDLIB)
rm -f /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR)
rm -f /usr/lib/$(STATICLIB)$(MAJOR)$(MINOR)$(FIX)
rm -f /usr/lib/$(STATICLIB)$(MAJOR) /usr/lib/$(STATICLIB)