Added an automatic computation of the revision number (which is
[selector.git] / Makefile
1
2 #
3 #  selector is a simple shell command for selection of strings with a
4 #  dynamic pattern-matching.
5 #
6 #  Copyright (c) 2009 Francois Fleuret
7 #  Written by Francois Fleuret <francois.fleuret@idiap.ch>
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 LDFLAGS=-lcurses
25
26 REVISION_NUMBER=$(shell git log | grep ^commit | wc -l)
27
28 ifeq ($(DEBUG),yes)
29   OPTIMIZE_FLAG = -ggdb3 -DDEBUG
30 else
31   OPTIMIZE_FLAG = -ggdb3 -O3
32 endif
33
34 CXXFLAGS = -DREVISION_NUMBER=$(REVISION_NUMBER) -Wall $(OPTIMIZE_FLAG)
35
36 all: selector
37
38 selector: selector.o
39         $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
40
41 clean:
42         rm -f *.o selector