New upstream release, includes a new --proxy options and honours the
[debian/bti.git] / Makefile
1 #
2 # Copyright (C) 2006 Greg Kroah-Hartman <greg@kroah.com>
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; version 2 of the License.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16 #
17 #
18
19 VERSION = 010
20
21 PROGRAM = bti
22
23 CORE_OBJS = \
24         bti.o
25
26 GEN_HEADERS = \
27         bti_version.h
28
29 MAN_PAGES = \
30         bti.1
31
32 CROSS_COMPILE ?=
33 CC = $(CROSS_COMPILE)gcc
34 LD = $(CROSS_COMPILE)gcc
35 AR = $(CROSS_COMPILE)ar
36
37 override CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2
38
39 WARNINGS        = -Wstrict-prototypes -Wsign-compare -Wshadow \
40                   -Wchar-subscripts -Wmissing-declarations -Wnested-externs \
41                   -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
42 CFLAGS          += $(WARNINGS)
43 LDFLAGS         += -Wl,-warn-common,--as-needed
44
45
46 ifeq ($(strip $(V)),)
47         E = @echo
48         Q = @
49 else
50         E = @\#
51         Q =
52 endif
53 export E Q
54
55
56 # We need -lcurl for the curl stuff
57 # We need -lsocket and -lnsl when on Solaris
58 # We need -lssl and -lcrypto when using libcurl with SSL support
59 # We need -lpthread for the pthread example
60 #LIB_OBJS = -lcurl -lnsl -lssl -lcrypto
61 LIB_OBJS = -lcurl -lnsl
62
63 all:    $(PROGRAM) $(MAN_PAGES)
64
65 # "Static Pattern Rule" to build all programs
66 bti: %: $(HEADERS) $(GEN_HEADERS) $(CORE_OBJS)
67         $(E) "  LD      " $@
68         $(Q) $(LD) $(LDFLAGS) $(CORE_OBJS) -o $@ $(LIB_OBJS)
69
70
71 # build the objects
72 %.o: %.c $(HEADERS) $(GEN_HEADERS)
73         $(E) "  CC      " $@
74         $(Q) $(CC) -c $(CFLAGS) $< -o $@
75
76
77 bti_version.h:
78         $(E) "  GENHDR  " $@
79         $(Q) echo "/* Generated by make. */" > $@
80         $(Q) echo \#define BTI_VERSION  \"$(VERSION)\" >> $@
81
82
83 # man pages
84 %.1: %.xml
85         $(E) "  XMLTO   " $@
86         $(Q) xmlto man $?
87 .PRECIOUS: %.3
88
89 clean:
90         $(E) "  CLEAN   "
91         $(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f
92         $(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f
93         $(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f
94         $(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f
95         $(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f
96         $(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f
97         $(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f
98         $(Q) - rm -f core $(PROGRAM) $(GEN_HEADERS)
99 .PHONY: clean
100
101 release:
102         $(Q) - rm -f bti-$(VERSION).tar.gz
103         head -1 ChangeLog | grep -q "to v$(VERSION)"
104         head -1 RELEASE-NOTES | grep -q "bti $(VERSION)"
105         git commit -a -m "release $(VERSION)"
106         cat .git/refs/heads/master > .git/refs/tags/$(VERSION)
107         @ echo
108         git archive --format=tar --prefix=bti-$(VERSION)/ HEAD | gzip -9v > bti-$(VERSION).tar.gz
109 .PHONY: release
110