forked from ccache/ccache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.mk.in
147 lines (126 loc) · 3.69 KB
/
dev.mk.in
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# GNU make syntax reigns in this file.
all_cflags += -Werror
all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
ASCIIDOC = asciidoc
GPERF = gperf
XSLTPROC = xsltproc
MANPAGE_XSL = $(shell if [ -e /usr/local/etc/asciidoc/docbook-xsl/manpage.xsl ]; \
then echo /usr/local/etc/asciidoc/docbook-xsl/manpage.xsl; \
else echo /etc/asciidoc/docbook-xsl/manpage.xsl; fi)
version := \
$(shell (git --git-dir=$(srcdir)/.git describe --dirty || git --git-dir=$(srcdir)/.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
ifneq ($(shell uname), Darwin)
dist_archives += ccache-$(version).tar.xz
endif
generated_docs = \
ccache.1 AUTHORS.html INSTALL.html LICENSE.html MANUAL.html NEWS.html \
README.html
built_dist_files = $(generated_docs)
headers = \
ccache.h \
compopt.h \
conf.h \
counters.h \
getopt_long.h \
hashtable.h \
hashtable_itr.h \
hashtable_private.h \
hashutil.h \
language.h \
macroskip.h \
manifest.h \
mdfour.h \
murmurhashneutral2.h \
system.h \
test/framework.h \
test/suites.h \
test/util.h
files_to_clean += *.tar.bz2 *.tar.gz *.tar.xz *.xml .deps/*
files_to_distclean += $(built_dist_files) version.c test/suites.h
files_to_distclean += .deps version.c dev.mk
source_dist_files = \
$(base_sources) \
$(headers) \
$(test_sources) \
AUTHORS.txt \
GPL-3.0.txt \
HACKING.txt \
INSTALL.txt \
LICENSE.txt \
MANUAL.txt \
Makefile.in \
NEWS.txt \
README.txt \
autogen.sh \
config.guess \
config.h.in \
config.sub \
configure \
configure.ac \
confitems.gperf \
confitems_lookup.c \
dev.mk.in \
envtoconfitems.gperf \
envtoconfitems_lookup.c \
install-sh \
main.c \
test.sh \
zlib/*.c \
zlib/*.h
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) && \
rsync -r --relative $(source_dist_files) $$dir) && \
cp $(built_dist_files) $$dir && \
echo "Remove this file to enable developer mode." >$$dir/dev_mode_disabled && \
(cd $$tmpdir && \
tarcompression= && \
case $@ in \
*.bz2) tarcompression=-j ;; \
*.gz) tarcompression=-z ;; \
*.xz) tarcompression=-J ;; \
esac && \
tar -c $$tarcompression -f $(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) $(all_cppflags) -I. $(all_cflags) -S -o /dev/null $(CHK_SOURCES)
-include .deps/*.d