Permalink
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (77 sloc) 2.81 KB
# GNU make syntax reigns in this file.
CFLAGS += -Werror
CPPFLAGS += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
ASCIIDOC = asciidoc
GPERF = gperf
XSLTPROC = xsltproc
MANPAGE_XSL = /etc/asciidoc/docbook-xsl/manpage.xsl
version := \
$(shell (git describe --dirty || git describe || echo vunknown) \
2>/dev/null | sed -e 's/v//' -e 's/-/+/' -e 's/-/_/g')
dist_dir = ccache-$(version)
dist_archives = \
ccache-$(version).tar.bz2 \
ccache-$(version).tar.gz \
ccache-$(version).tar.xz
generated_docs = \
ccache.1 AUTHORS.html INSTALL.html LICENSE.html MANUAL.html NEWS.html \
README.html
built_dist_files = $(generated_docs)
headers = \
ccache.h hashtable.h hashtable_itr.h hashtable_private.h hashutil.h \
manifest.h mdfour.h counters.h murmurhashneutral2.h getopt_long.h \
language.h system.h compopt.h macroskip.h conf.h \
test/framework.h test/suites.h test/util.h
files_to_clean += *.tar.bz2 *.tar.gz *.tar.xz *.xml .deps/*
files_to_clean += $(built_dist_files) version.c test/suites.h
files_to_distclean += .deps version.c dev.mk
source_dist_files = \
main.c $(base_sources) $(test_sources) $(headers) zlib/*.c zlib/*.h \
config.h.in configure install-sh Makefile.in test.sh GPL-3.0.txt \
AUTHORS.txt INSTALL.txt LICENSE.txt MANUAL.txt NEWS.txt README.txt \
confitems_lookup.c envtoconfitems_lookup.c
dist_files = \
$(addprefix $(srcdir)/, $(source_dist_files)) \
$(built_dist_files)
ifneq ($(shell sed 's/.*"\(.*\)".*/\1/' version.c 2>/dev/null),$(version))
$(shell echo 'const char CCACHE_VERSION[] = "$(version)";' >version.c)
endif
version.o: version.c
%_lookup.c: %.gperf
$(GPERF) $< >$@
echo "static const size_t `echo $* | tr a-z A-Z`_TOTAL_KEYWORDS = `sed -nr 's/.*TOTAL_KEYWORDS = ([0-9]+).*/\1/p' $@`;" >>$@
.PHONY: dist
dist: $(dist_archives)
$(dist_archives): $(dist_files)
tmpdir=$$(mktemp -d /tmp/tmp-ccache-dist.XXXXXX) && \
dir=$$tmpdir/$(dist_dir) && \
mkdir $$dir && \
(cd $(srcdir) && \
cp -r --parents $(source_dist_files) $$dir) && \
cp $(built_dist_files) $$dir && \
(cd $$tmpdir && \
tar caf $(CURDIR)/$@ $(dist_dir)) && \
rm -rf $$tmpdir
.PHONY: distcheck
distcheck: $(firstword $(dist_archives))
tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \
(cd $$tmpdir && \
tar xjf $(CURDIR)/$< && \
mkdir -p $(dist_dir)/build && \
cd $(dist_dir)/build && \
../configure --prefix=$$tmpdir/root && \
$(MAKE) install && \
$(MAKE) installcheck) && \
rm -rf $$tmpdir
.PHONY: docs
docs: $(generated_docs)
%.html: %.txt
$(ASCIIDOC) -a revnumber=$(version) -a toc -b xhtml11 $<
%.xml: %.txt
$(ASCIIDOC) -a revnumber=$(version) -d manpage -b docbook $<
ccache.1: MANUAL.xml
$(XSLTPROC) --nonet $(MANPAGE_XSL) $<
.PHONY: check-syntax
check-syntax:
$(CC) @CPPFLAGS@ -I. $(CFLAGS) -S -o /dev/null $(CHK_SOURCES)
-include .deps/*.d