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