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