Added the -Wextra option to the compiler.
[finddup.git] / Makefile
1
2 #
3 #  finddup is a simple utility designed to display the list of files and
4 #  directories with disk occupancy, sorted according to it.
5 #
6 #  Copyright (c) 2009 Francois Fleuret
7 #  Written by Francois Fleuret <francois@fleuret.org>
8 #
9 #  This file is part of finddup.
10 #
11 #  finddup 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 #  finddup 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 finddup.  If not, see <http://www.gnu.org/licenses/>.
22 #
23
24 BINARY_PATH = /usr/bin
25 MAN_PATH = /usr/share/man/man1
26
27 ifeq ($(WITH_MD5),yes)
28   LDFLAGS=-lssl
29   MD5FLAG=-DWITH_MD5
30 else
31   LDFLAGS=
32   MD5FLAG=
33 endif
34
35 UNAME=\"$(shell uname -srmn)\"
36
37 ifeq ($(DEBUG),yes)
38   OPTIMIZE_FLAG = -ggdb3 -DDEBUG -fno-omit-frame-pointer
39 else
40   OPTIMIZE_FLAG = -O2
41 endif
42
43 CFLAGS = -Wall -Wextra -ansi -pedantic -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DUNAME="$(UNAME)" $(MD5FLAG) $(OPTIMIZE_FLAG)
44
45 all: finddup
46
47 finddup: finddup.o
48         $(CC) -o $@ $^ $(LDFLAGS)
49
50 install: finddup
51         install -m 755 finddup $(BINARY_PATH)
52         install -m 644 finddup.1 $(MAN_PATH)
53         gzip $(MAN_PATH)/finddup.1
54
55 uninstall:
56         rm $(BINARY_PATH)/finddup
57         rm $(MAN_PATH)/finddup.1.gz
58
59 clean:
60         rm -f *.o finddup