Realized that recent changes deserve a new version number.
[selector] / Makefile
1
2 #
3 #  selector is a simple command line utility for selection of strings
4 #  with a dynamic pattern-matching.
5 #
6 #  Copyright (c) 2009-2012 Francois Fleuret
7 #  Written by Francois Fleuret <francois@fleuret.org>
8 #
9 #  This file is part of selector.
10 #
11 #  selector is free software: you can redistribute it and/or modify
12 #  it under the terms of the GNU General Public License version 3 as
13 #  published by the Free Software Foundation.
14 #
15 #  selector is distributed in the hope that it will be useful, but
16 #  WITHOUT ANY WARRANTY; without even the implied warranty of
17 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 #  General Public License for more details.
19 #
20 #  You should have received a copy of the GNU General Public License
21 #  along with selector.  If not, see <http://www.gnu.org/licenses/>.
22 #
23
24 BINARY_PATH = $(DESTDIR)/usr/local/bin
25 MAN_PATH = $(DESTDIR)/usr/local/share/man/man1
26
27 LDFLAGS=-lcurses
28
29 UNAME=\"$(shell uname -srmn)\"
30
31 ifeq ($(DEBUG),yes)
32   OPTIMIZE_FLAG = -ggdb3 -DDEBUG -fno-omit-frame-pointer
33 else
34   OPTIMIZE_FLAG = -O2
35 endif
36
37 CFLAGS = -Wall -Wextra -ansi -pedantic -DUNAME="$(UNAME)" $(OPTIMIZE_FLAG)
38
39 all: selector
40
41 selector: selector.o
42         $(CC) -o $@ $^ $(LDFLAGS)
43
44 install: selector
45         mkdir -p $(BINARY_PATH) $(MAN_PATH)
46         install -m 755 selector $(BINARY_PATH)
47         install -m 755 bash-selector.sh $(BINARY_PATH)
48         install -m 644 selector.1 $(MAN_PATH)
49         gzip $(MAN_PATH)/selector.1
50
51 uninstall:
52         rm $(BINARY_PATH)/selector
53         rm $(BINARY_PATH)/bash-selector.sh
54         rm $(MAN_PATH)/selector.1.gz
55
56 clean:
57         rm -f *.o selector