-# Settings common to many Squid Makefiles
+## Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
-# This file should be included first in all src/subdir/Makefile.am
-# so it must not contain stuff specific to or bad for some subdirectories.
+## Settings common to many Squid Makefiles
-# TODO: make this set by configure?
-AM_CFLAGS = @SQUID_CFLAGS@
-AM_CXXFLAGS = @SQUID_CXXFLAGS@
+## This file should be included first in all src/subdir/Makefile.am
+## so it must not contain stuff specific to or bad for some subdirectories.
+
+## Default variables
+DEFAULT_HTTP_PORT = 3128
+DEFAULT_ICP_PORT = 3130
+DEFAULT_PREFIX = $(prefix)
+DEFAULT_CONFIG_DIR = $(sysconfdir)
+DEFAULT_CONFIG_FILE = $(DEFAULT_CONFIG_DIR)/squid.conf
+DEFAULT_MIME_TABLE = $(DEFAULT_CONFIG_DIR)/mime.conf
+DEFAULT_SSL_CRTD = $(libexecdir)/`echo security_file_certgen | sed '$(transform);s/$$/$(EXEEXT)/'`
+DEFAULT_LOG_PREFIX = $(DEFAULT_LOG_DIR)
+DEFAULT_CACHE_LOG = $(DEFAULT_LOG_PREFIX)/cache.log
+DEFAULT_ACCESS_LOG = $(DEFAULT_LOG_PREFIX)/access.log
+DEFAULT_STORE_LOG = $(DEFAULT_LOG_PREFIX)/store.log
+DEFAULT_NETDB_FILE = $(DEFAULT_SWAP_DIR)/netdb.state
+DEFAULT_SSL_DB_DIR = $(DEFAULT_SWAP_DIR)/ssl_db
+DEFAULT_PINGER = $(libexecdir)/`echo pinger | sed '$(transform);s/$$/$(EXEEXT)/'`
+DEFAULT_UNLINKD = $(libexecdir)/`echo unlinkd | sed '$(transform);s/$$/$(EXEEXT)/'`
+DEFAULT_LOGFILED = $(libexecdir)/`echo log_file_daemon | sed '$(transform);s/$$/$(EXEEXT)/'`
+DEFAULT_DISKD = $(libexecdir)/`echo diskd | sed '$(transform);s/$$/$(EXEEXT)/'`
+DEFAULT_ICON_DIR = $(datadir)/icons
+DEFAULT_ERROR_DIR = $(datadir)/errors
+
+## TODO: make this set by configure?
+AM_CFLAGS = $(SQUID_CFLAGS)
+AM_CXXFLAGS = $(SQUID_CXXFLAGS)
DEFS = @DEFS@
-# so that others can always use += for this variable
+## so that others can always use += for these variables
CLEANFILES =
+check_PROGRAMS =
+TESTS =
-INCLUDES = \
+AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/include \
+ -I$(top_srcdir)/lib \
-I$(top_srcdir)/src \
- -I$(top_builddir)/lib \
- @SQUID_CPPUNIT_INC@
-
-# make all compiled sources depend on generated files
-# XXX: Do we really need this? Does auto-dependency tracking work?
-# XXX: And should not autoconf be in $(top_builddir)?
-$(OBJS): $(top_srcdir)/include/version.h $(top_srcdir)/include/autoconf.h
-
-check_PROGRAMS = testHeaders
-TESTS = $(check_PROGRAMS)
-
-## Special Universal .h dependency test script
-## aborts build process on errors
-testHeaders: $(srcdir)/*.h
- $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" "$(srcdir)/" || exit 1
-
-## No such file...
-testHeaders.c:
- touch testHeaders.c
-CLEANFILES += testHeaders.c
+ -I$(top_builddir)/include \
+ $(LIBCPPUNIT_CFLAGS)
+
+## Kerberos headers require their include path.
+## Because we use libcompat for comm_err.h header protections ...
+AM_CPPFLAGS += $(KRB5INCS)
+
+## Loadable Modules requires LTDL include paths.
+## Because we need this to use the libray linking headers...
+if ENABLE_LOADABLE_MODULES
+AM_CPPFLAGS += $(INCLTDL)
+endif
+
+## make all compiled sources depend on generated files
+## XXX: Do we really need this? Does auto-dependency tracking work?
+$(OBJS): $(top_srcdir)/include/version.h $(top_builddir)/include/autoconf.h
+
+## Internal profiler is used even by some of the compat library stuff.
+if ENABLE_XPROF_STATS
+LIBPROFILER = $(top_builddir)/lib/profiler/libprofiler.la
+else
+LIBPROFILER=
+endif
+
+## Because compatibility is almost universal. And the link order is important.
+COMPAT_LIB = $(top_builddir)/compat/libcompatsquid.la $(LIBPROFILER)
+
+## Some helpers are written in Perl and need the local shell defined properly
+subst_perlshell = sed -e 's,[@]PERL[@],$(PERL),g' <$(srcdir)/$@.pl.in >$@ || ($(RM) -f $@ ; exit 1)