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 = 013 |
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 -lreadline for readline support |
59 |
# We need -lssl and -lcrypto when using libcurl with SSL support |
60 |
# We need -lpthread for the pthread example |
61 |
#LIB_OBJS = -lcurl -lnsl -lssl -lcrypto |
62 |
LIB_OBJS = -lcurl -lnsl -lreadline |
63 |
|
64 |
all: $(PROGRAM) $(MAN_PAGES) |
65 |
|
66 |
# "Static Pattern Rule" to build all programs |
67 |
bti: %: $(HEADERS) $(GEN_HEADERS) $(CORE_OBJS) |
68 |
$(E) " LD " $@ |
69 |
$(Q) $(LD) $(LDFLAGS) $(CORE_OBJS) -o $@ $(LIB_OBJS) |
70 |
|
71 |
|
72 |
# build the objects |
73 |
%.o: %.c $(HEADERS) $(GEN_HEADERS) |
74 |
$(E) " CC " $@ |
75 |
$(Q) $(CC) -c $(CFLAGS) $< -o $@ |
76 |
|
77 |
|
78 |
bti_version.h: Makefile |
79 |
$(E) " GENHDR " $@ |
80 |
$(Q) echo "/* Generated by make. */" > $@ |
81 |
$(Q) echo \#define BTI_VERSION \"$(VERSION)\" >> $@ |
82 |
|
83 |
|
84 |
# man pages |
85 |
%.1: %.xml |
86 |
$(E) " XMLTO " $@ |
87 |
$(Q) xmlto man $? |
88 |
.PRECIOUS: %.3 |
89 |
|
90 |
clean: |
91 |
$(E) " CLEAN " |
92 |
$(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f |
93 |
$(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f |
94 |
$(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f |
95 |
$(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f |
96 |
$(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f |
97 |
$(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f |
98 |
$(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f |
99 |
$(Q) - rm -f core $(PROGRAM) $(GEN_HEADERS) |
100 |
.PHONY: clean |
101 |
|
102 |
release: |
103 |
$(Q) - rm -f bti-$(VERSION).tar.gz |
104 |
head -1 ChangeLog | grep -q "to v$(VERSION)" |
105 |
head -1 RELEASE-NOTES | grep -q "bti $(VERSION)" |
106 |
git commit -a -m "release $(VERSION)" |
107 |
cat .git/refs/heads/master > .git/refs/tags/$(VERSION) |
108 |
@ echo |
109 |
git archive --format=tar --prefix=bti-$(VERSION)/ HEAD | gzip -9v > bti-$(VERSION).tar.gz |
110 |
.PHONY: release |
111 |
|