6 exec_prefix = @exec_prefix@
9 datarootdir = @datarootdir@
10 sysconfdir = @sysconfdir@
11 installcmd = @INSTALL@
23 all_cflags = $(CFLAGS)
24 all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir)/src -I$(builddir)/unittest $(CPPFLAGS)
25 extra_libs = @extra_libs@
55 src/confitems_lookup.c \
56 src/envtoconfitems_lookup.c \
59 src/murmurhashneutral2.c \
61 base_sources = $(non_3pp_sources) $(generated_sources) $(3pp_sources)
62 base_objs = $(base_sources:.c=.o)
64 ccache_sources = src/main.c $(base_sources)
65 ccache_objs = $(ccache_sources:.c=.o)
81 zlib_objs = $(zlib_sources:.c=.o)
83 test_suites = @test_suites@
84 test_sources = unittest/main.c unittest/framework.c unittest/util.c
85 test_sources += $(test_suites)
86 test_objs = $(test_sources:.c=.o)
88 all_sources = $(ccache_sources) $(test_sources)
89 all_objs = $(ccache_objs) $(test_objs) $(zlib_objs)
97 unittest/run$(EXEEXT) \
100 files_to_distclean = Makefile config.h config.log config.status
105 ccache$(EXEEXT): $(ccache_objs) $(extra_libs)
106 $(if $(quiet),@echo " LD $@")
107 $(Q)$(CC) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
109 ccache.1: doc/ccache.1
110 $(if $(quiet),@echo " CP $@")
114 install: ccache$(EXEEXT) @disable_man@ccache.1
115 $(if $(quiet),@echo " INSTALL ccache$(EXEEXT)")
116 $(Q)$(installcmd) -d $(DESTDIR)$(bindir)
117 $(Q)$(installcmd) -m 755 ccache$(EXEEXT) $(DESTDIR)$(bindir)
118 @disable_man@ $(if $(quiet),@echo " INSTALL ccache.1")
119 @disable_man@ $(Q)$(installcmd) -d $(DESTDIR)$(mandir)/man1
120 @disable_man@ $(Q)-$(installcmd) -m 644 ccache.1 $(DESTDIR)$(mandir)/man1/
124 rm -rf $(files_to_clean)
126 src/snprintf.o: CFLAGS += @no_implicit_fallthrough_warning@
127 $(zlib_objs): CPPFLAGS += -include config.h
128 $(zlib_objs): CFLAGS += @no_implicit_fallthrough_warning@
130 src/zlib/libz.a: $(zlib_objs)
131 $(if $(quiet),@echo " AR $@")
132 $(Q)$(AR) cr $@ $(zlib_objs)
133 $(if $(quiet),@echo " RANLIB $@")
137 perf: ccache$(EXEEXT)
138 $(srcdir)/perf/perf.py --ccache ccache$(EXEEXT) $(CC) $(all_cppflags) $(all_cflags) $(srcdir)/src/ccache.c
141 test: ccache$(EXEEXT) unittest/run$(EXEEXT)
142 $(if $(quiet),@echo " TEST unittest/run$(EXEEXT)")
143 $(Q)unittest/run$(EXEEXT)
144 $(if $(quiet),@echo " TEST $(srcdir)/test/run")
145 $(Q)CC='$(CC)' $(BASH) $(srcdir)/test/run
148 unittest: unittest/run$(EXEEXT)
149 $(if $(quiet),@echo " TEST $@")
150 $(Q)unittest/run$(EXEEXT)
152 unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs)
153 $(if $(quiet),@echo " LD $@")
154 $(Q)$(CC) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS)
156 unittest/main.o: unittest/suites.h
158 unittest/suites.h: $(test_suites) Makefile
159 $(if $(quiet),@echo " GEN $@")
160 $(Q)ls $^ | grep -v Makefile | xargs sed -n 's/TEST_SUITE(\(.*\))/SUITE(\1)/p' >$@
167 rm -rf $(files_to_distclean)
170 installcheck: ccache$(EXEEXT) unittest/run$(EXEEXT)
171 unittest/run$(EXEEXT)
172 CCACHE=$(bindir)/ccache CC='$(CC)' $(BASH) $(srcdir)/test/run
175 $(if $(quiet),@echo " CC $@")
176 $(Q)$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<