Reorder build options to guarantee usage of bundled zlib headers and libraries

This commit is contained in:
Joel Rosdahl 2012-08-07 21:26:29 +02:00
parent 050e6a7c18
commit b97ef53d9c
3 changed files with 24 additions and 16 deletions

View File

@ -12,12 +12,16 @@ installcmd = @INSTALL@
AR = @AR@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @DEFS@ @CPPFLAGS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir)
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@
EXEEXT = @EXEEXT@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
RANLIB = @RANLIB@
libs = @LIBS@ -lz
all_cflags = $(CFLAGS)
all_cppflags = @DEFS@ @extra_cppflags@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir) $(CPPFLAGS)
all_ldflags = @extra_ldflags@ $(LDFLAGS)
all_libs = @extra_libs@ $(LIBS)
base_sources = \
ccache.c mdfour.c hash.c execute.c util.c args.c stats.c version.c \
@ -48,8 +52,8 @@ files_to_distclean = Makefile config.h config.log config.status
.PHONY: all
all: ccache$(EXEEXT)
ccache$(EXEEXT): $(ccache_objs) @extra_deps@
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ccache_objs) $(libs)
ccache$(EXEEXT): $(ccache_objs) $(all_libs)
$(CC) $(all_cflags) $(all_ldflags) -o $@ $(ccache_objs) $(all_libs)
.PHONY: install
install: all
@ -70,15 +74,15 @@ zlib/libz.a: $(zlib_objs)
.PHONY: perf
perf: ccache$(EXEEXT)
$(srcdir)/perf.py --ccache ccache$(EXEEXT) $(CC) $(CFLAGS) $(CPPFLAGS) $(srcdir)/ccache.c
$(srcdir)/perf.py --ccache ccache$(EXEEXT) $(CC) $(all_cppflags) $(all_cflags) $(srcdir)/ccache.c
.PHONY: test
test: ccache$(EXEEXT) test/main$(EXEEXT)
test/main$(EXEEXT)
CC='$(CC)' $(srcdir)/test.sh
test/main$(EXEEXT): $(base_objs) $(test_objs) @extra_deps@
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(base_objs) $(test_objs) $(libs)
test/main$(EXEEXT): $(base_objs) $(test_objs) $(all_libs)
$(CC) $(all_cflags) $(all_ldflags) -o $@ $(base_objs) $(test_objs) $(all_libs)
test/main.o: test/suites.h
@ -98,6 +102,6 @@ installcheck: ccache$(EXEEXT) test/main$(EXEEXT)
CCACHE=$(bindir)/ccache CC='$(CC)' $(srcdir)/test.sh
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<
@include_dev_mk@

View File

@ -15,7 +15,9 @@ case $host in
;;
esac
AC_SUBST(extra_deps)
AC_SUBST(extra_cppflags)
AC_SUBST(extra_ldflags)
AC_SUBST(extra_libs)
AC_SUBST(include_dev_mk)
AC_SUBST(test_suites)
@ -112,10 +114,12 @@ else
fi
if test x${use_bundled_zlib} = xyes; then
extra_deps="zlib/libz.a"
CPPFLAGS="$CPPFLAGS -I\$(srcdir)/zlib"
LIBS="-Lzlib $LIBS"
extra_cppflags="-I\$(srcdir)/zlib"
extra_ldflags="-Lzlib"
extra_libs="zlib/libz.a"
mkdir -p zlib
else
extra_libs="-lz"
fi
AC_C_INLINE

View File

@ -1,7 +1,7 @@
# GNU make syntax reigns in this file.
CFLAGS += -Werror
CPPFLAGS += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
all_cflags += -Werror
all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$<)).d
ASCIIDOC = asciidoc
GPERF = gperf
@ -92,6 +92,6 @@ ccache.1: MANUAL.xml
.PHONY: check-syntax
check-syntax:
$(CC) @CPPFLAGS@ -I. $(CFLAGS) -S -o /dev/null $(CHK_SOURCES)
$(CC) $(all_cppflags) -I. $(all_cflags) -S -o /dev/null $(CHK_SOURCES)
-include .deps/*.d