forked from ccache/ccache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
217 lines (184 loc) · 6.2 KB
/
Makefile.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
srcdir = @srcdir@
builddir = @builddir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
datarootdir = @datarootdir@
sysconfdir = @sysconfdir@
installcmd = @INSTALL@
BASH = @BASH@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
EXEEXT = @EXEEXT@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
all_cflags = $(CFLAGS)
all_cxxflags = $(CXXFLAGS)
all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir)/src -I$(builddir)/unittest $(CPPFLAGS)
extra_libs = @extra_libs@
v_at_0 = yes
v_at_ = $(v_at_0)
quiet := $(v_at_$(V))
Q=$(if $(quiet),@)
non_third_party_sources = \
src/Args.cpp \
src/AtomicFile.cpp \
src/CacheEntryReader.cpp \
src/CacheEntryWriter.cpp \
src/CacheFile.cpp \
src/Compression.cpp \
src/Compressor.cpp \
src/Config.cpp \
src/Context.cpp \
src/Counters.cpp \
src/Decompressor.cpp \
src/Lockfile.cpp \
src/NullCompressor.cpp \
src/NullDecompressor.cpp \
src/ProgressBar.cpp \
src/Stat.cpp \
src/Util.cpp \
src/ZstdCompressor.cpp \
src/ZstdDecompressor.cpp \
src/argprocessing.cpp \
src/ccache.cpp \
src/cleanup.cpp \
src/compopt.cpp \
src/compress.cpp \
src/execute.cpp \
src/exitfn.cpp \
src/hash.cpp \
src/hashutil.cpp \
src/language.cpp \
src/legacy_util.cpp \
src/logging.cpp \
src/manifest.cpp \
src/result.cpp \
src/stats.cpp \
src/win32compat.cpp
generated_sources = \
src/version.cpp
third_party_sources = \
src/third_party/format.cpp \
src/third_party/getopt_long.c \
src/third_party/xxhash.c
extra_sources = @extra_sources@
base_sources = $(non_third_party_sources) $(generated_sources) $(third_party_sources) $(extra_sources)
base_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(base_sources)))
non_third_party_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(non_third_party_sources)))
ccache_sources = src/main.cpp $(base_sources)
ccache_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(ccache_sources)))
test_suites += unittest/test_Args.cpp
test_suites += unittest/test_AtomicFile.cpp
test_suites += unittest/test_Checksum.cpp
test_suites += unittest/test_Compression.cpp
test_suites += unittest/test_Config.cpp
test_suites += unittest/test_FormatNonstdStringView.cpp
test_suites += unittest/test_Lockfile.cpp
test_suites += unittest/test_NullCompression.cpp
test_suites += unittest/test_ScopeGuard.cpp
test_suites += unittest/test_Stat.cpp
test_suites += unittest/test_Util.cpp
test_suites += unittest/test_ZstdCompression.cpp
test_suites += unittest/test_argument_processing.cpp
test_suites += unittest/test_compopt.cpp
test_suites += unittest/test_hash.cpp
test_suites += unittest/test_hashutil.cpp
test_suites += unittest/test_legacy_util.cpp
test_sources += unittest/catch2_tests.cpp
test_sources += unittest/framework.cpp
test_sources += unittest/main.cpp
test_sources += unittest/util.cpp
test_sources += $(test_suites)
test_objs = $(test_sources:.cpp=.o)
all_sources = $(ccache_sources) $(test_sources)
all_objs = $(ccache_objs) $(test_objs)
files_to_clean = \
$(all_objs) \
ccache$(EXEEXT) \
src/*~ \
testdir.* \
unittest/run$(EXEEXT) \
*~
files_to_distclean = Makefile config.h config.log config.status
.PHONY: all
all: ccache$(EXEEXT)
ccache$(EXEEXT): $(ccache_objs) $(extra_libs)
$(if $(quiet),@echo " LD $@")
$(Q)$(CXX) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
ccache.1: doc/ccache.1
$(if $(quiet),@echo " CP $@")
$(Q)cp $< $@
.PHONY: install
install: ccache$(EXEEXT) @disable_man@ccache.1
$(if $(quiet),@echo " INSTALL ccache$(EXEEXT)")
$(Q)$(installcmd) -d $(DESTDIR)$(bindir)
$(Q)$(installcmd) -m 755 ccache$(EXEEXT) $(DESTDIR)$(bindir)
@disable_man@ $(if $(quiet),@echo " INSTALL ccache.1")
@disable_man@ $(Q)$(installcmd) -d $(DESTDIR)$(mandir)/man1
@disable_man@ $(Q)-$(installcmd) -m 644 ccache.1 $(DESTDIR)$(mandir)/man1/
.PHONY: clean
clean:
rm -rf $(files_to_clean)
[ ! -f src/third_party/zstd/Makefile ] || $(MAKE) -C src/third_party/zstd/lib clean
[ ! -f src/third_party/libb2/Makefile ] || $(MAKE) -C src/third_party/libb2 clean
$(non_third_party_objs) $(test_objs): CFLAGS += @extra_warnings@
$(non_third_party_objs) $(test_objs): CXXFLAGS += @extra_warnings@
libzstd_options = \
ZSTD_LEGACY_SUPPORT=0 \
ZSTD_LIB_DEPRECATED=0 \
ZSTD_LIB_DICTBUILDER=0
src/third_party/zstd/lib/libzstd.a:
$(MAKE) -C src/third_party/zstd/lib libzstd.a $(libzstd_options) CC="$(CC)"
libb2_options = \
--disable-shared \
--enable-static
@disable_cross@# cross compilation
@disable_cross@libb2_options += \
@disable_cross@ --build=@build_alias@ \
@disable_cross@ --host=@host_alias@ \
@disable_cross@ --target=@target_alias@ \
@disable_cross@ --disable-openmp \
@disable_cross@ --disable-fat \
@disable_cross@ --disable-native
src/third_party/libb2/src/.libs/libb2.a:
cd src/third_party/libb2 && ./configure ${libb2_options} CC="$(CC)"
$(MAKE) -C src/third_party/libb2 CC="$(CC)" \
@disable_cross@ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
.PHONY: performance
performance: ccache$(EXEEXT)
$(srcdir)/misc/performance --ccache ccache$(EXEEXT) $(CXX) $(all_cppflags) $(all_cxxflags) $(srcdir)/src/ccache.cpp
.PHONY: test
test: ccache$(EXEEXT) unittest/run$(EXEEXT)
$(if $(quiet),@echo " TEST unittest/run$(EXEEXT)")
$(Q)unittest/run$(EXEEXT)
$(if $(quiet),@echo " TEST $(srcdir)/test/run")
$(Q)CC='$(CC)' $(BASH) $(srcdir)/test/run
.PHONY: unittest
unittest: unittest/run$(EXEEXT)
$(if $(quiet),@echo " TEST $@")
$(Q)unittest/run$(EXEEXT)
unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs)
$(if $(quiet),@echo " LD $@")
$(Q)$(CXX) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
.PHONY: check
check: test
.PHONY: distclean
distclean: clean
rm -rf $(files_to_distclean)
.PHONY: installcheck
installcheck: ccache$(EXEEXT) unittest/run$(EXEEXT)
unittest/run$(EXEEXT)
CCACHE=$(bindir)/ccache CC='$(CC)' $(BASH) $(srcdir)/test/run
.c.o:
$(if $(quiet),@echo " CC $@")
$(Q)$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<
.cpp.o:
$(if $(quiet),@echo " CXX $@")
$(Q)$(CXX) $(all_cppflags) $(all_cxxflags) -c -o $@ $<
@include_dev_mk@