2 # Copyright (C) 2006 Greg Kroah-Hartman <greg@kroah.com>
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.
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.
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.
22 SCRIPTS = bti-shrink-urls
34 CC = $(CROSS_COMPILE)gcc
35 LD = $(CROSS_COMPILE)gcc
36 AR = $(CROSS_COMPILE)ar
38 XML2_CFLAGS = `xml2-config --cflags`
39 PCRE_CFLAGS = `pcre-config --cflags`
40 override CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2 $(XML2_CFLAGS) $(PCRE_CFLAGS)
42 WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \
43 -Wchar-subscripts -Wmissing-declarations -Wnested-externs \
44 -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
46 LDFLAGS += -Wl,-warn-common,--as-needed
52 INSTALL_BIN = ${INSTALL} -m 0755 -t ${DEST}${PREFIX}/bin
53 INSTALL_MAN = ${INSTALL} -m 0644 -t ${DEST}${PREFIX}/share/man
65 # We need -lcurl for the curl stuff
66 # We need -lsocket and -lnsl when on Solaris
67 # We need -lreadline for readline support
68 # We need -lssl and -lcrypto when using libcurl with SSL support
69 # We need -lpthread for the pthread example
70 #LIB_OBJS = -lcurl -lnsl -lssl -lcrypto
71 LIB_OBJS = -lcurl -lnsl -lreadline
72 LIB_XML2 = `xml2-config --libs`
73 LIB_PCRE = `pcre-config --libs`
75 all: $(PROGRAM) $(MAN_PAGES)
77 # "Static Pattern Rule" to build all programs
78 bti: %: $(HEADERS) $(GEN_HEADERS) $(CORE_OBJS)
80 $(Q) $(LD) $(LDFLAGS) $(CORE_OBJS) -o $@ $(LIB_OBJS) $(LIB_XML2) $(LIB_PCRE)
83 %.o: %.c $(HEADERS) $(GEN_HEADERS)
85 $(Q) $(CC) -c $(CFLAGS) $< -o $@
88 bti_version.h: Makefile
90 $(Q) echo "/* Generated by make. */" > $@
91 $(Q) echo \#define BTI_VERSION \"$(VERSION)\" >> $@
102 $(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f
103 $(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f
104 $(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f
105 $(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f
106 $(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f
107 $(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f
108 $(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f
109 $(Q) - rm -f core $(PROGRAM) $(GEN_HEADERS)
113 $(Q) - rm -f bti-$(VERSION).tar.gz
114 head -1 ChangeLog | grep -q "to v$(VERSION)"
115 head -1 RELEASE-NOTES | grep -q "bti $(VERSION)"
116 git commit -a -m "release $(VERSION)"
117 cat .git/refs/heads/master > .git/refs/tags/$(VERSION)
119 git archive --format=tar --prefix=bti-$(VERSION)/ HEAD | gzip -9v > bti-$(VERSION).tar.gz
123 $(E) " INSTALL " ${DEST}${PREFIX}
124 ${Q} ${INSTALL_BIN} ${PROGRAM} ${SCRIPTS}
125 ${Q} ${INSTALL_MAN} ${MAN_PAGES}