Index: src/libs/zbxcommon/Makefile.am
===================================================================
--- src/libs/zbxcommon/Makefile.am	(revision 65451)
+++ src/libs/zbxcommon/Makefile.am	(working copy)
@@ -3,15 +3,15 @@
 noinst_LIBRARIES = libzbxcommon.a
 
 libzbxcommon_a_SOURCES = \
-	misc.c \
-	xml.c \
+	alias.c \
 	comms.c \
-	str.c \
-	zbxgetopt.c \
-	alias.c \
 	file.c \
+	iprange.c \
+	misc.c \
 	setproctitle.c \
-	iprange.c \
-	variant.c
+	str.c \
+	variant.c \
+	xml.c \
+	zbxgetopt.c
 
-libzbxcommon_a_CFLAGS = @ICONV_CFLAGS@
+libzbxcommon_a_CFLAGS = $(ICONV_CFLAGS)
Index: src/libs/zbxcommshigh/Makefile.am
===================================================================
--- src/libs/zbxcommshigh/Makefile.am	(revision 65451)
+++ src/libs/zbxcommshigh/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 noinst_LIBRARIES = libzbxcommshigh.a
 
-libzbxcommshigh_a_SOURCES = comms.c
+libzbxcommshigh_a_SOURCES = \
+	comms.c
Index: src/libs/zbxconf/Makefile.am
===================================================================
--- src/libs/zbxconf/Makefile.am	(revision 65451)
+++ src/libs/zbxconf/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 noinst_LIBRARIES = libzbxconf.a
 
-libzbxconf_a_SOURCES = cfg.c
+libzbxconf_a_SOURCES = \
+	cfg.c
Index: src/libs/zbxcrypto/Makefile.am
===================================================================
--- src/libs/zbxcrypto/Makefile.am	(revision 65451)
+++ src/libs/zbxcrypto/Makefile.am	(working copy)
@@ -3,11 +3,11 @@
 noinst_LIBRARIES = libzbxcrypto.a
 
 libzbxcrypto_a_SOURCES = \
+	base64.c \
 	md5.c \
-	base64.c \
 	tls.c \
 	tls.h \
-	tls_tcp.h \
-	tls_tcp_active.h
+	tls_tcp_active.h \
+	tls_tcp.h
 
-libzbxcrypto_a_CFLAGS = @TLS_CFLAGS@
+libzbxcrypto_a_CFLAGS = $(TLS_CFLAGS)
Index: src/libs/zbxdb/Makefile.am
===================================================================
--- src/libs/zbxdb/Makefile.am	(revision 65451)
+++ src/libs/zbxdb/Makefile.am	(working copy)
@@ -5,4 +5,4 @@
 libzbxdb_a_SOURCES = \
 	db.c
 
-libzbxdb_a_CFLAGS = @DB_CFLAGS@
+libzbxdb_a_CFLAGS = $(DB_CFLAGS)
Index: src/libs/zbxdbcache/Makefile.am
===================================================================
--- src/libs/zbxdbcache/Makefile.am	(revision 65451)
+++ src/libs/zbxdbcache/Makefile.am	(working copy)
@@ -5,9 +5,11 @@
 libzbxdbcache_a_SOURCES = \
 	dbcache.c \
 	dbconfig.c \
+	item_preproc.c \
+	item_preproc.h
 	valuecache.c \
 	valuecache.h \
-	item_preproc.c \
-	item_preproc.h
 
-libzbxdbcache_a_CFLAGS = -I@top_srcdir@/src/zabbix_server/ -I@top_srcdir@/src/libs/zbxalgo
+libzbxdbcache_a_CFLAGS = \
+	-I$(top_srcdir)/src/zabbix_server \
+	-I$(top_srcdir)/src/libs/zbxalgo
Index: src/libs/zbxdbhigh/Makefile.am
===================================================================
--- src/libs/zbxdbhigh/Makefile.am	(revision 65451)
+++ src/libs/zbxdbhigh/Makefile.am	(working copy)
@@ -3,21 +3,23 @@
 noinst_LIBRARIES = libzbxdbhigh.a
 
 libzbxdbhigh_a_SOURCES = \
-	host.c \
-	odbc.c \
 	db.c \
 	dbschema.c \
-	proxy.c \
 	discovery.c \
+	host.c \
+	itservices.c \
 	lld.c lld.h \
 	lld_common.c \
+	lld_graph.c \
+	lld_host.c \
 	lld_item.c \
-	lld_graph.c \
 	lld_trigger.c \
-	lld_host.c \
-	itservices.c \
+	odbc.c \
+	proxy.c \
+	template.h \
 	template_item.c \
-	template.h \
 	trigger.c
 
-libzbxdbhigh_a_CFLAGS = -I@top_srcdir@/src/zabbix_server/ @UNIXODBC_CFLAGS@
+libzbxdbhigh_a_CFLAGS = \
+	-I$(top_srcdir)/src/zabbix_server \
+	$(UNIXODBC_CFLAGS)
Index: src/libs/zbxdbupgrade/Makefile.am
===================================================================
--- src/libs/zbxdbupgrade/Makefile.am	(revision 65451)
+++ src/libs/zbxdbupgrade/Makefile.am	(working copy)
@@ -2,7 +2,8 @@
 
 noinst_LIBRARIES = libzbxdbupgrade.a
 
-libzbxdbupgrade_a_SOURCES = dbupgrade.c \
+libzbxdbupgrade_a_SOURCES = \
+	dbupgrade.c \
 	dbupgrade_2010.c \
 	dbupgrade_2020.c \
 	dbupgrade_2030.c \
Index: src/libs/zbxexec/Makefile.am
===================================================================
--- src/libs/zbxexec/Makefile.am	(revision 65451)
+++ src/libs/zbxexec/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 noinst_LIBRARIES = libzbxexec.a
 
-libzbxexec_a_SOURCES = execute.c
+libzbxexec_a_SOURCES = \
+	execute.c
Index: src/libs/zbxlog/Makefile.am
===================================================================
--- src/libs/zbxlog/Makefile.am	(revision 65451)
+++ src/libs/zbxlog/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 noinst_LIBRARIES = libzbxlog.a
 
-libzbxlog_a_SOURCES = log.c
+libzbxlog_a_SOURCES = \
+	log.c
Index: src/libs/zbxmedia/Makefile.am
===================================================================
--- src/libs/zbxmedia/Makefile.am	(revision 65451)
+++ src/libs/zbxmedia/Makefile.am	(working copy)
@@ -3,9 +3,9 @@
 noinst_LIBRARIES = libzbxmedia.a
 
 libzbxmedia_a_SOURCES = \
-			email.c \
-			eztexting.c \
-			jabber.c \
-			sms.c
+	email.c \
+	eztexting.c \
+	jabber.c \
+	sms.c
 
-libzbxmedia_a_CFLAGS = @JABBER_CPPFLAGS@
+libzbxmedia_a_CFLAGS = $(JABBER_CPPFLAGS)
Index: src/libs/zbxmemory/Makefile.am
===================================================================
--- src/libs/zbxmemory/Makefile.am	(revision 65451)
+++ src/libs/zbxmemory/Makefile.am	(working copy)
@@ -3,4 +3,5 @@
 noinst_LIBRARIES = libzbxmemory.a
 
 libzbxmemory_a_SOURCES = \
-	memalloc.c strpool.c
+	memalloc.c \
+	strpool.c
Index: src/libs/zbxnix/Makefile.am
===================================================================
--- src/libs/zbxnix/Makefile.am	(revision 65453)
+++ src/libs/zbxnix/Makefile.am	(working copy)
@@ -3,13 +3,15 @@
 noinst_LIBRARIES = libzbxnix.a
 
 libzbxnix_a_SOURCES = \
+	control.c \
+	control.h \
+	coredump.c \
 	daemon.c \
+	dshm.c \
+	fatal.c \
+	fatal.h \
+	ipc.c \
+	ipcservice.c \
 	pid.c \
-	ipc.c \
-	fatal.c fatal.h \
-	sighandler.c \
 	sigcommon.h \
-	control.c control.h \
-	dshm.c \
-	coredump.c \
-	ipcservice.c
+	sighandler.c
Index: src/libs/zbxregexp/Makefile.am
===================================================================
--- src/libs/zbxregexp/Makefile.am	(revision 65451)
+++ src/libs/zbxregexp/Makefile.am	(working copy)
@@ -5,5 +5,5 @@
 libzbxregexp_a_SOURCES = \
 	zbxregexp.c
 
-EXTRA_DIST = gnuregex.c
-
+EXTRA_DIST = \
+	gnuregex.c
\ No newline at end of file
Index: src/libs/zbxself/Makefile.am
===================================================================
--- src/libs/zbxself/Makefile.am	(revision 65451)
+++ src/libs/zbxself/Makefile.am	(working copy)
@@ -2,4 +2,5 @@
 
 noinst_LIBRARIES = libzbxself.a
 
-libzbxself_a_SOURCES = selfmon.c
+libzbxself_a_SOURCES = \
+	selfmon.c
Index: src/libs/zbxserver/Makefile.am
===================================================================
--- src/libs/zbxserver/Makefile.am	(revision 65451)
+++ src/libs/zbxserver/Makefile.am	(working copy)
@@ -3,8 +3,10 @@
 noinst_LIBRARIES = libzbxserver.a
 
 libzbxserver_a_SOURCES = \
-	evalfunc.c evalfunc.h \
+	evalfunc.c \
+	evalfunc.h \
 	expression.c \
-	macrofunc.c macrofunc.h
+	macrofunc.c \
+	macrofunc.h
 
-libzbxserver_a_CFLAGS = -I@top_srcdir@/src/libs/zbxdbcache
+libzbxserver_a_CFLAGS = -I$(top_srcdir)/src/libs/zbxdbcache
Index: src/libs/zbxsys/Makefile.am
===================================================================
--- src/libs/zbxsys/Makefile.am	(revision 65451)
+++ src/libs/zbxsys/Makefile.am	(working copy)
@@ -2,6 +2,9 @@
 
 noinst_LIBRARIES = libzbxsys.a
 
-libzbxsys_a_SOURCES = threads.c mutexs.c
+libzbxsys_a_SOURCES = \
+	mutexs.c \
+	threads.c
 
-EXTRA_DIST = symbols.c
+EXTRA_DIST = \
+	symbols.c
\ No newline at end of file
Index: src/libs/zbxsysinfo/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/Makefile.am	(working copy)
@@ -19,19 +19,9 @@
 	agent \
 	common \
 	simple \
-	@ARCH@
+	$(ARCH)
 
 EXTRA_DIST = \
-	aix/aix.c aix/hostname.c \
-	freebsd/freebsd.c freebsd/hostname.c \
-	hpux/hpux.c hpux/hostname.c \
-	linux/linux.c linux/hostname.c \
-	netbsd/netbsd.c netbsd/hostname.c \
-	openbsd/openbsd.c openbsd/hostname.c \
-	osf/osf.c osf/hostname.c \
-	osx/osx.c osx/hostname.c \
-	solaris/solaris.c solaris/hostname.c \
-	unknown/unknown.c unknown/hostname.c \
 	win32
 
 noinst_LIBRARIES = \
Index: src/libs/zbxsysinfo/agent/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/agent/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/agent/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libagentsysinfo.a
 
-libagentsysinfo_a_SOURCES = agent.c agent.h
+libagentsysinfo_a_SOURCES = \
+	agent.c \
+	agent.h
Index: src/libs/zbxsysinfo/aix/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/aix/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/aix/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	aix.c \
Index: src/libs/zbxsysinfo/common/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/common/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/common/Makefile.am	(working copy)
@@ -2,13 +2,20 @@
 
 noinst_LIBRARIES = libcommonsysinfo.a
 
-libcommonsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libcommonsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libcommonsysinfo_a_SOURCES = \
-	common.c common.h \
-	file.c file.h \
-	dir.c dir.h \
-	cpu.c cpu.h \
-	http.c http.h \
-	net.c net.h \
-	system.c system.h
+	common.c \
+	common.h \
+	cpu.c \
+	cpu.h \
+	dir.c \
+	dir.h \
+	file.c \
+	file.h \
+	http.c \
+	http.h \
+	net.c \
+	net.h \
+	system.c \
+	system.h
Index: src/libs/zbxsysinfo/freebsd/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/freebsd/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/freebsd/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
Index: src/libs/zbxsysinfo/hpux/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/hpux/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/hpux/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	cpu.c \
Index: src/libs/zbxsysinfo/linux/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/linux/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/linux/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
@@ -9,15 +9,18 @@
 	cpu.c \
 	diskio.c \
 	diskspace.c \
-	hardware.c hardware.h \
+	hardware.c \
+	hardware.h \
 	inodes.c \
 	kernel.c \
 	linux.c \
 	memory.c \
 	net.c \
-	proc.c proc.h \
+	proc.c \
+	proc.h \
 	sensors.c \
-	software.c software.h \
+	software.c \
+	software.h \
 	system.c \
 	swap.c \
 	uptime.c
Index: src/libs/zbxsysinfo/netbsd/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/netbsd/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/netbsd/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
Index: src/libs/zbxsysinfo/openbsd/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/openbsd/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/openbsd/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
Index: src/libs/zbxsysinfo/osf/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/osf/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/osf/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	cpu.c \
Index: src/libs/zbxsysinfo/osx/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/osx/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/osx/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
Index: src/libs/zbxsysinfo/simple/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/simple/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/simple/Makefile.am	(working copy)
@@ -3,7 +3,9 @@
 noinst_LIBRARIES = libsimplesysinfo.a
 
 libsimplesysinfo_a_SOURCES = \
-	simple.c simple.h \
-	ntp.c ntp.h
+	ntp.c \
+	ntp.h \
+	simple.c \
+	simple.h
 
-libsimplesysinfo_a_CFLAGS = @LDAP_CPPFLAGS@
+libsimplesysinfo_a_CFLAGS = $(LDAP_CPPFLAGS)
Index: src/libs/zbxsysinfo/solaris/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/solaris/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/solaris/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	boottime.c \
Index: src/libs/zbxsysinfo/unknown/Makefile.am
===================================================================
--- src/libs/zbxsysinfo/unknown/Makefile.am	(revision 65451)
+++ src/libs/zbxsysinfo/unknown/Makefile.am	(working copy)
@@ -2,7 +2,7 @@
 
 noinst_LIBRARIES = libspecsysinfo.a libspechostnamesysinfo.a
 
-libspecsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/
+libspecsysinfo_a_CFLAGS = -I$(top_srcdir)/src/zabbix_agent
 
 libspecsysinfo_a_SOURCES = \
 	diskio.c \
Index: src/zabbix_agent/Makefile.am
===================================================================
--- src/zabbix_agent/Makefile.am	(revision 65451)
+++ src/zabbix_agent/Makefile.am	(working copy)
@@ -1,58 +1,68 @@
 ## Process this file with automake to produce Makefile.in
 
 EXTRA_DIST = \
-	eventlog.c eventlog.h \
-	perfstat.c perfstat.h
+	eventlog.c \
+	eventlog.h \
+	perfstat.c \
+	perfstat.h
 
 sbin_PROGRAMS = zabbix_agentd
 
 zabbix_agentd_SOURCES = \
-	active.c active.h \
-	stats.c stats.h \
-	cpustat.c cpustat.h \
-	diskdevices.c diskdevices.h \
-	vmstats.c vmstats.h \
-	logfiles.c logfiles.h \
-	zbxconf.c zbxconf.h \
-	listener.c listener.h \
-	procstat.c procstat.h \
-	zabbix_agentd.c
+	active.c \
+	active.h \
+	cpustat.c \
+	cpustat.h \
+	diskdevices.c \
+	diskdevices.h \
+	listener.c \
+	listener.h \
+	logfiles.c \
+	logfiles.h \
+	procstat.c \
+	procstat.h \
+	stats.c \
+	stats.h \
+	vmstats.c \
+	vmstats.h \
+	zabbix_agentd.c \
+	zbxconf.c \
+	zbxconf.h
 
 zabbix_agentd_LDADD = \
-	$(top_srcdir)/src/libs/zbxsysinfo/libzbxagentsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/$(ARCH)/libspecsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/agent/libagentsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
-	$(top_srcdir)/src/libs/zbxlog/libzbxlog.a \
-	$(top_srcdir)/src/libs/zbxregexp/libzbxregexp.a \
-	$(top_srcdir)/src/libs/zbxalgo/libzbxalgo.a \
-	$(top_srcdir)/src/libs/zbxsys/libzbxsys.a \
-	$(top_srcdir)/src/libs/zbxnix/libzbxnix.a \
-	$(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \
-	$(top_srcdir)/src/libs/zbxconf/libzbxconf.a \
-	$(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \
-	$(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \
-	$(top_srcdir)/src/libs/zbxjson/libzbxjson.a \
-	$(top_srcdir)/src/libs/zbxexec/libzbxexec.a \
-	$(top_srcdir)/src/libs/zbxmodules/libzbxmodules.a \
-	$(top_srcdir)/src/libs/zbxself/libzbxself.a
+	$(top_builddir)/src/libs/zbxsysinfo/libzbxagentsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspecsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/agent/libagentsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
+	$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
+	$(top_builddir)/src/libs/zbxregexp/libzbxregexp.a \
+	$(top_builddir)/src/libs/zbxalgo/libzbxalgo.a \
+	$(top_builddir)/src/libs/zbxsys/libzbxsys.a \
+	$(top_builddir)/src/libs/zbxnix/libzbxnix.a \
+	$(top_builddir)/src/libs/zbxcomms/libzbxcomms.a \
+	$(top_builddir)/src/libs/zbxconf/libzbxconf.a \
+	$(top_builddir)/src/libs/zbxcommon/libzbxcommon.a \
+	$(top_builddir)/src/libs/zbxcrypto/libzbxcrypto.a \
+	$(top_builddir)/src/libs/zbxjson/libzbxjson.a \
+	$(top_builddir)/src/libs/zbxexec/libzbxexec.a \
+	$(top_builddir)/src/libs/zbxmodules/libzbxmodules.a \
+	$(top_builddir)/src/libs/zbxself/libzbxself.a \
+	$(AGENT_LIBS)
 
-zabbix_agentd_LDADD += @AGENT_LIBS@
+zabbix_agentd_LDFLAGS = $(AGENT_LDFLAGS)
 
-zabbix_agentd_LDFLAGS = @AGENT_LDFLAGS@
-
 zabbix_agentd_CFLAGS = \
 	-DZABBIX_DAEMON \
-	-DSYSCONFDIR="\"@sysconfdir@\"" \
-	-DLIBDIR="\"@libdir@\""
+	-DSYSCONFDIR="\"$(sysconfdir)\"" \
+	-DLIBDIR="\"$(libdir)\""
 
 AGENTD_CONFIG = zabbix_agentd.conf
-INCLUDE_DIR = $(DESTDIR)@sysconfdir@/$(AGENTD_CONFIG).d
-MODULES_DIR = $(DESTDIR)@libdir@
+INCLUDE_DIR = $(DESTDIR)$(sysconfdir)/$(AGENTD_CONFIG).d
+MODULES_DIR = $(DESTDIR)$(libdir)
 
 install-data-hook:
 	$(MKDIR_P) "$(INCLUDE_DIR)"
 	$(MKDIR_P) "$(MODULES_DIR)"
-	test -f "$(DESTDIR)@sysconfdir@/$(AGENTD_CONFIG)" || cp "../../conf/$(AGENTD_CONFIG)" "$(DESTDIR)@sysconfdir@"
+	test -f "$(DESTDIR)$(sysconfdir)/$(AGENTD_CONFIG)" || cp "../../conf/$(AGENTD_CONFIG)" "$(DESTDIR)$(sysconfdir)"
Index: src/zabbix_get/Makefile.am
===================================================================
--- src/zabbix_get/Makefile.am	(revision 65451)
+++ src/zabbix_get/Makefile.am	(working copy)
@@ -2,17 +2,17 @@
 
 bin_PROGRAMS = zabbix_get
 
-zabbix_get_SOURCES = zabbix_get.c
+zabbix_get_SOURCES = \
+	zabbix_get.c
 
 zabbix_get_LDADD = \
-	$(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \
-	$(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \
-	$(top_srcdir)/src/libs/zbxlog/libzbxlog.a \
-	$(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \
-	$(top_srcdir)/src/libs/zbxsys/libzbxsys.a \
-	$(top_srcdir)/src/libs/zbxnix/libzbxnix.a \
-	$(top_srcdir)/src/libs/zbxconf/libzbxconf.a
+	$(top_builddir)/src/libs/zbxcomms/libzbxcomms.a \
+	$(top_builddir)/src/libs/zbxcommon/libzbxcommon.a \
+	$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
+	$(top_builddir)/src/libs/zbxcrypto/libzbxcrypto.a \
+	$(top_builddir)/src/libs/zbxsys/libzbxsys.a \
+	$(top_builddir)/src/libs/zbxnix/libzbxnix.a \
+	$(top_builddir)/src/libs/zbxconf/libzbxconf.a \
+	$(ZBXGET_LIBS)
 
-zabbix_get_LDADD += @ZBXGET_LIBS@
-
-zabbix_get_LDFLAGS = @ZBXGET_LDFLAGS@
+zabbix_get_LDFLAGS = $(ZBXGET_LDFLAGS)
Index: src/zabbix_java/Makefile.am
===================================================================
--- src/zabbix_java/Makefile.am	(revision 65451)
+++ src/zabbix_java/Makefile.am	(working copy)
@@ -4,7 +4,6 @@
 	bin \
 	lib \
 	src \
-	Makefile.am \
 	settings.sh \
 	shutdown.sh \
 	startup.sh
Index: src/zabbix_proxy/Makefile.am
===================================================================
--- src/zabbix_proxy/Makefile.am	(revision 65451)
+++ src/zabbix_proxy/Makefile.am	(working copy)
@@ -9,70 +9,69 @@
 sbin_PROGRAMS = zabbix_proxy
 
 zabbix_proxy_SOURCES = \
-	servercomms.c servercomms.h \
 	events.c \
+	servercomms.c \
+	servercomms.h \
 	proxy.c \
 	scripts.c
 
 zabbix_proxy_LDADD = \
 	heart/libzbxheart.a \
-	$(top_srcdir)/src/zabbix_server/dbsyncer/libzbxdbsyncer.a \
-	$(top_srcdir)/src/zabbix_server/discoverer/libzbxdiscoverer.a \
+	$(top_builddir)/src/zabbix_server/dbsyncer/libzbxdbsyncer.a \
+	$(top_builddir)/src/zabbix_server/discoverer/libzbxdiscoverer.a \
 	housekeeper/libzbxhousekeeper.a \
-	$(top_srcdir)/src/zabbix_server/httppoller/libzbxhttppoller.a \
+	$(top_builddir)/src/zabbix_server/httppoller/libzbxhttppoller.a \
 	proxyconfig/libzbxproxyconfig.a \
-	$(top_srcdir)/src/zabbix_server/pinger/libzbxpinger.a \
-	$(top_srcdir)/src/zabbix_server/poller/libzbxpoller.a \
-	$(top_srcdir)/src/zabbix_server/trapper/libzbxtrapper.a \
-	$(top_srcdir)/src/zabbix_server/snmptrapper/libzbxsnmptrapper.a \
-	$(top_srcdir)/src/zabbix_server/ipmi/libipmi.a \
+	$(top_builddir)/src/zabbix_server/pinger/libzbxpinger.a \
+	$(top_builddir)/src/zabbix_server/poller/libzbxpoller.a \
+	$(top_builddir)/src/zabbix_server/trapper/libzbxtrapper.a \
+	$(top_builddir)/src/zabbix_server/snmptrapper/libzbxsnmptrapper.a \
+	$(top_builddir)/src/zabbix_server/ipmi/libipmi.a \
 	datasender/libzbxdatasender.a \
-	$(top_srcdir)/src/zabbix_server/selfmon/libzbxselfmon.a \
-	$(top_srcdir)/src/zabbix_server/vmware/libzbxvmware.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/libzbxproxysysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
-	$(top_srcdir)/src/libs/zbxlog/libzbxlog.a \
-	$(top_srcdir)/src/libs/zbxserver/libzbxserver.a \
-	$(top_srcdir)/src/libs/zbxdbcache/libzbxdbcache.a \
-	$(top_srcdir)/src/libs/zbxmemory/libzbxmemory.a \
-	$(top_srcdir)/src/libs/zbxregexp/libzbxregexp.a \
-	$(top_srcdir)/src/libs/zbxnix/libzbxnix.a \
-	$(top_srcdir)/src/libs/zbxalgo/libzbxalgo.a \
-	$(top_srcdir)/src/libs/zbxsys/libzbxsys.a \
-	$(top_srcdir)/src/libs/zbxconf/libzbxconf.a \
-	$(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \
-	$(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \
-	$(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \
-	$(top_srcdir)/src/libs/zbxcommshigh/libzbxcommshigh.a \
-	$(top_srcdir)/src/libs/zbxjson/libzbxjson.a \
-	$(top_srcdir)/src/libs/zbxexec/libzbxexec.a \
-	$(top_srcdir)/src/libs/zbxself/libzbxself.a \
-	$(top_srcdir)/src/libs/zbxicmpping/libzbxicmpping.a \
-	$(top_srcdir)/src/libs/zbxdbupgrade/libzbxdbupgrade.a \
-	$(top_srcdir)/src/libs/zbxdbhigh/libzbxdbhigh.a \
-	$(top_srcdir)/src/libs/zbxdb/libzbxdb.a \
-	$(top_srcdir)/src/libs/zbxmodules/libzbxmodules.a
+	$(top_builddir)/src/zabbix_server/selfmon/libzbxselfmon.a \
+	$(top_builddir)/src/zabbix_server/vmware/libzbxvmware.a \
+	$(top_builddir)/src/libs/zbxsysinfo/libzbxproxysysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \
+	$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
+	$(top_builddir)/src/libs/zbxserver/libzbxserver.a \
+	$(top_builddir)/src/libs/zbxdbcache/libzbxdbcache.a \
+	$(top_builddir)/src/libs/zbxmemory/libzbxmemory.a \
+	$(top_builddir)/src/libs/zbxregexp/libzbxregexp.a \
+	$(top_builddir)/src/libs/zbxnix/libzbxnix.a \
+	$(top_builddir)/src/libs/zbxalgo/libzbxalgo.a \
+	$(top_builddir)/src/libs/zbxsys/libzbxsys.a \
+	$(top_builddir)/src/libs/zbxconf/libzbxconf.a \
+	$(top_builddir)/src/libs/zbxcommon/libzbxcommon.a \
+	$(top_builddir)/src/libs/zbxcrypto/libzbxcrypto.a \
+	$(top_builddir)/src/libs/zbxcomms/libzbxcomms.a \
+	$(top_builddir)/src/libs/zbxcommshigh/libzbxcommshigh.a \
+	$(top_builddir)/src/libs/zbxjson/libzbxjson.a \
+	$(top_builddir)/src/libs/zbxexec/libzbxexec.a \
+	$(top_builddir)/src/libs/zbxself/libzbxself.a \
+	$(top_builddir)/src/libs/zbxicmpping/libzbxicmpping.a \
+	$(top_builddir)/src/libs/zbxdbupgrade/libzbxdbupgrade.a \
+	$(top_builddir)/src/libs/zbxdbhigh/libzbxdbhigh.a \
+	$(top_builddir)/src/libs/zbxdb/libzbxdb.a \
+	$(top_builddir)/src/libs/zbxmodules/libzbxmodules.a
 	
 
-zabbix_proxy_LDADD += @PROXY_LIBS@
+zabbix_proxy_LDFLAGS = $(PROXY_LDFLAGS)
 
-zabbix_proxy_LDFLAGS = @PROXY_LDFLAGS@
-
 zabbix_proxy_CFLAGS = \
 	-DZABBIX_DAEMON \
-	-DSYSCONFDIR="\"@sysconfdir@\"" \
-	-DDATADIR="\"@datadir@\"" \
-	-DLIBDIR="\"@libdir@\""
+	-DSYSCONFDIR="\"$(sysconfdir)\"" \
+	-DDATADIR="\"$(datadir)\"" \
+	-DLIBDIR="\"$(libdir)\""
 
 PROXY_CONFIG = zabbix_proxy.conf
-INCLUDE_DIR = $(DESTDIR)@sysconfdir@/$(PROXY_CONFIG).d
-EXSCRIPTS_DIR = $(DESTDIR)@datadir@/zabbix/externalscripts
-MODULES_DIR = $(DESTDIR)@libdir@
+INCLUDE_DIR = $(DESTDIR)$(sysconfdir)/$(PROXY_CONFIG).d
+EXSCRIPTS_DIR = $(DESTDIR)$(datadir)/zabbix/externalscripts
+MODULES_DIR = $(DESTDIR)$(libdir)
 
 install-data-hook:
 	$(MKDIR_P) "$(INCLUDE_DIR)"
 	$(MKDIR_P) "$(EXSCRIPTS_DIR)"
 	$(MKDIR_P) "$(MODULES_DIR)"
-	test -f "$(DESTDIR)@sysconfdir@/$(PROXY_CONFIG)" || cp "../../conf/$(PROXY_CONFIG)" "$(DESTDIR)@sysconfdir@"
+	test -f "$(DESTDIR)$([Bsysconfdir)/$(PROXY_CONFIG)" || cp "../../conf/$(PROXY_CONFIG)" "$(DESTDIR)$(sysconfdir)"
Index: src/zabbix_proxy/datasender/Makefile.am
===================================================================
--- src/zabbix_proxy/datasender/Makefile.am	(revision 65451)
+++ src/zabbix_proxy/datasender/Makefile.am	(working copy)
@@ -3,4 +3,5 @@
 noinst_LIBRARIES = libzbxdatasender.a
 
 libzbxdatasender_a_SOURCES = \
-	datasender.c datasender.h
+	datasender.c \
+	datasender.h
Index: src/zabbix_proxy/heart/Makefile.am
===================================================================
--- src/zabbix_proxy/heart/Makefile.am	(revision 65451)
+++ src/zabbix_proxy/heart/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxheart.a
 
-libzbxheart_a_SOURCES = heart.c heart.h
+libzbxheart_a_SOURCES = \
+	heart.c \
+	heart.h
Index: src/zabbix_proxy/housekeeper/Makefile.am
===================================================================
--- src/zabbix_proxy/housekeeper/Makefile.am	(revision 65451)
+++ src/zabbix_proxy/housekeeper/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxhousekeeper.a
 
-libzbxhousekeeper_a_SOURCES = housekeeper.c housekeeper.h
+libzbxhousekeeper_a_SOURCES = \
+	housekeeper.c \
+	housekeeper.h
Index: src/zabbix_proxy/proxyconfig/Makefile.am
===================================================================
--- src/zabbix_proxy/proxyconfig/Makefile.am	(revision 65451)
+++ src/zabbix_proxy/proxyconfig/Makefile.am	(working copy)
@@ -3,4 +3,5 @@
 noinst_LIBRARIES = libzbxproxyconfig.a
 
 libzbxproxyconfig_a_SOURCES = \
-	proxyconfig.c proxyconfig.h
+	proxyconfig.c \
+	proxyconfig.h
Index: src/zabbix_sender/Makefile.am
===================================================================
--- src/zabbix_sender/Makefile.am	(revision 65451)
+++ src/zabbix_sender/Makefile.am	(working copy)
@@ -2,20 +2,20 @@
 
 bin_PROGRAMS = zabbix_sender
 
-zabbix_sender_SOURCES = zabbix_sender.c
+zabbix_sender_SOURCES = \
+	zabbix_sender.c
 
 zabbix_sender_LDADD = \
-	$(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \
-	$(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \
-	$(top_srcdir)/src/libs/zbxlog/libzbxlog.a \
-	$(top_srcdir)/src/libs/zbxsys/libzbxsys.a \
-	$(top_srcdir)/src/libs/zbxnix/libzbxnix.a \
-	$(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \
-	$(top_srcdir)/src/libs/zbxconf/libzbxconf.a \
-	$(top_srcdir)/src/libs/zbxjson/libzbxjson.a
+	$(top_builddir)/src/libs/zbxcomms/libzbxcomms.a \
+	$(top_builddir)/src/libs/zbxcommon/libzbxcommon.a \
+	$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
+	$(top_builddir)/src/libs/zbxsys/libzbxsys.a \
+	$(top_builddir)/src/libs/zbxnix/libzbxnix.a \
+	$(top_builddir)/src/libs/zbxcrypto/libzbxcrypto.a \
+	$(top_builddir)/src/libs/zbxconf/libzbxconf.a \
+	$(top_builddir)/src/libs/zbxjson/libzbxjson.a \
+	$(SENDER_LIBS)
 
-zabbix_sender_LDADD += @SENDER_LIBS@
+zabbix_sender_LDFLAGS = $(SENDER_LDFLAGS)
 
-zabbix_sender_LDFLAGS = @SENDER_LDFLAGS@
-
 EXTRA_DIST = win32
Index: src/zabbix_server/Makefile.am
===================================================================
--- src/zabbix_server/Makefile.am	(revision 65451)
+++ src/zabbix_server/Makefile.am	(working copy)
@@ -24,24 +24,33 @@
 sbin_PROGRAMS = zabbix_server
 
 zabbix_server_SOURCES = \
-	actions.c actions.h \
-	operations.c operations.h \
-	events.c events.h \
-	scripts.c scripts.h \
+	actions.c \
+	actions.h \
+	events.c \
+	events.h \
+	operations.c \
+	operations.h \
+	scripts.c \
+	scripts.h \
 	server.c
 
 zabbix_server_LDADD = \
 	alerter/libzbxalerter.a \
+	dbconfig/libzbxdbconfig.a \
 	dbsyncer/libzbxdbsyncer.a \
-	dbconfig/libzbxdbconfig.a \
 	discoverer/libzbxdiscoverer.a \
+	escalator/libzbxescalator.a \
+	housekeeper/libzbxhousekeeper.a \
+	httppoller/libzbxhttppoller.a \
 	pinger/libzbxpinger.a \
 	poller/libzbxpoller.a \
-	housekeeper/libzbxhousekeeper.a \
+	proxypoller/libzbxproxypoller.a \
+	selfmon/libzbxselfmon.a \
+	snmptrapper/libzbxsnmptrapper.a \
+	taskmanager/libzbxtaskmanager.a \
 	timer/libzbxtimer.a \
 	trapper/libzbxtrapper.a \
-	snmptrapper/libzbxsnmptrapper.a \
-	httppoller/libzbxhttppoller.a \
+	vmware/libzbxvmware.a \
 	watchdog/libzbxwatchdog.a \
 	escalator/libzbxescalator.a \
 	proxypoller/libzbxproxypoller.a \
@@ -49,48 +58,46 @@
 	vmware/libzbxvmware.a \
 	taskmanager/libzbxtaskmanager.a \
 	ipmi/libipmi.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/libzbxserversysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
-	$(top_srcdir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
-	$(top_srcdir)/src/libs/zbxlog/libzbxlog.a \
-	$(top_srcdir)/src/libs/zbxserver/libzbxserver.a \
-	$(top_srcdir)/src/libs/zbxdbcache/libzbxdbcache.a \
-	$(top_srcdir)/src/libs/zbxmemory/libzbxmemory.a \
-	$(top_srcdir)/src/libs/zbxregexp/libzbxregexp.a \
-	$(top_srcdir)/src/libs/zbxnix/libzbxnix.a \
-	$(top_srcdir)/src/libs/zbxalgo/libzbxalgo.a \
-	$(top_srcdir)/src/libs/zbxsys/libzbxsys.a \
-	$(top_srcdir)/src/libs/zbxconf/libzbxconf.a \
-	$(top_srcdir)/src/libs/zbxmedia/libzbxmedia.a \
-	$(top_srcdir)/src/libs/zbxcommon/libzbxcommon.a \
-	$(top_srcdir)/src/libs/zbxcrypto/libzbxcrypto.a \
-	$(top_srcdir)/src/libs/zbxcomms/libzbxcomms.a \
-	$(top_srcdir)/src/libs/zbxcommshigh/libzbxcommshigh.a \
-	$(top_srcdir)/src/libs/zbxjson/libzbxjson.a \
-	$(top_srcdir)/src/libs/zbxexec/libzbxexec.a \
-	$(top_srcdir)/src/libs/zbxself/libzbxself.a \
-	$(top_srcdir)/src/libs/zbxicmpping/libzbxicmpping.a \
-	$(top_srcdir)/src/libs/zbxdbupgrade/libzbxdbupgrade.a \
-	$(top_srcdir)/src/libs/zbxdbhigh/libzbxdbhigh.a \
-	$(top_srcdir)/src/libs/zbxdb/libzbxdb.a \
-	$(top_srcdir)/src/libs/zbxmodules/libzbxmodules.a
+	$(top_builddir)/src/libs/zbxsysinfo/libzbxserversysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \
+	$(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \
+	$(top_builddir)/src/libs/zbxlog/libzbxlog.a \
+	$(top_builddir)/src/libs/zbxserver/libzbxserver.a \
+	$(top_builddir)/src/libs/zbxdbcache/libzbxdbcache.a \
+	$(top_builddir)/src/libs/zbxmemory/libzbxmemory.a \
+	$(top_builddir)/src/libs/zbxregexp/libzbxregexp.a \
+	$(top_builddir)/src/libs/zbxnix/libzbxnix.a \
+	$(top_builddir)/src/libs/zbxalgo/libzbxalgo.a \
+	$(top_builddir)/src/libs/zbxsys/libzbxsys.a \
+	$(top_builddir)/src/libs/zbxconf/libzbxconf.a \
+	$(top_builddir)/src/libs/zbxmedia/libzbxmedia.a \
+	$(top_builddir)/src/libs/zbxcommon/libzbxcommon.a \
+	$(top_builddir)/src/libs/zbxcrypto/libzbxcrypto.a \
+	$(top_builddir)/src/libs/zbxcomms/libzbxcomms.a \
+	$(top_builddir)/src/libs/zbxcommshigh/libzbxcommshigh.a \
+	$(top_builddir)/src/libs/zbxjson/libzbxjson.a \
+	$(top_builddir)/src/libs/zbxexec/libzbxexec.a \
+	$(top_builddir)/src/libs/zbxself/libzbxself.a \
+	$(top_builddir)/src/libs/zbxicmpping/libzbxicmpping.a \
+	$(top_builddir)/src/libs/zbxdbupgrade/libzbxdbupgrade.a \
+	$(top_builddir)/src/libs/zbxdbhigh/libzbxdbhigh.a \
+	$(top_builddir)/src/libs/zbxdb/libzbxdb.a \
+	$(top_builddir)/src/libs/zbxmodules/libzbxmodules.a
 
-zabbix_server_LDADD += @SERVER_LIBS@
+zabbix_server_LDFLAGS = $(SERVER_LDFLAGS)
 
-zabbix_server_LDFLAGS = @SERVER_LDFLAGS@
-
 zabbix_server_CFLAGS = \
 	-DZABBIX_DAEMON \
-	-DSYSCONFDIR="\"@sysconfdir@\"" \
-	-DDATADIR="\"@datadir@\"" \
-	-DLIBDIR="\"@libdir@\"" \
-	-I@top_srcdir@/src/libs/zbxdbcache
+	-DSYSCONFDIR="\"$(sysconfdir)\"" \
+	-DDATADIR="\"$(datadir)\"" \
+	-DLIBDIR="\"$(libdir)\"" \
+	-I$(top_srdcir)/src/libs/zbxdbcache
 
 SERVER_CONFIG = zabbix_server.conf
-INCLUDE_DIR = $(DESTDIR)@sysconfdir@/$(SERVER_CONFIG).d
-EXSCRIPTS_DIR = $(DESTDIR)@datadir@/zabbix/externalscripts
-ALSCRIPTS_DIR = $(DESTDIR)@datadir@/zabbix/alertscripts
-MODULES_DIR = $(DESTDIR)@libdir@
+INCLUDE_DIR = $(DESTDIR)$(sysconfdir)/$(SERVER_CONFIG).d
+EXSCRIPTS_DIR = $(DESTDIR)$(datadir)/zabbix/externalscripts
+ALSCRIPTS_DIR = $(DESTDIR)$(datadir)/zabbix/alertscripts
+MODULES_DIR = $(DESTDIR)$(libdir)
 
 install-data-hook:
 	$(MKDIR_P) "$(INCLUDE_DIR)"
@@ -97,4 +104,4 @@
 	$(MKDIR_P) "$(EXSCRIPTS_DIR)"
 	$(MKDIR_P) "$(ALSCRIPTS_DIR)"
 	$(MKDIR_P) "$(MODULES_DIR)"
-	test -f "$(DESTDIR)@sysconfdir@/$(SERVER_CONFIG)" || cp "../../conf/$(SERVER_CONFIG)" "$(DESTDIR)@sysconfdir@"
+	test -f "$(DESTDIR)$(sysconfdir)/$(SERVER_CONFIG)" || cp "../../conf/$(SERVER_CONFIG)" "$(DESTDIR)$(sysconfdir)"
Index: src/zabbix_server/alerter/Makefile.am
===================================================================
--- src/zabbix_server/alerter/Makefile.am	(revision 65451)
+++ src/zabbix_server/alerter/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxalerter.a
 
-libzbxalerter_a_SOURCES = alerter.c alerter.h
+libzbxalerter_a_SOURCES = \
+	alerter.c \
+	alerter.h
Index: src/zabbix_server/dbconfig/Makefile.am
===================================================================
--- src/zabbix_server/dbconfig/Makefile.am	(revision 65451)
+++ src/zabbix_server/dbconfig/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxdbconfig.a
 
-libzbxdbconfig_a_SOURCES = dbconfig.c dbconfig.h
+libzbxdbconfig_a_SOURCES = \
+	dbconfig.c \
+	dbconfig.h
Index: src/zabbix_server/dbsyncer/Makefile.am
===================================================================
--- src/zabbix_server/dbsyncer/Makefile.am	(revision 65451)
+++ src/zabbix_server/dbsyncer/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxdbsyncer.a
 
-libzbxdbsyncer_a_SOURCES = dbsyncer.c dbsyncer.h
+libzbxdbsyncer_a_SOURCES = \
+	dbsyncer.c \
+	dbsyncer.h
Index: src/zabbix_server/discoverer/Makefile.am
===================================================================
--- src/zabbix_server/discoverer/Makefile.am	(revision 65451)
+++ src/zabbix_server/discoverer/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxdiscoverer.a
 
-libzbxdiscoverer_a_SOURCES = discoverer.c discoverer.h
+libzbxdiscoverer_a_SOURCES = \
+	discoverer.c \
+	discoverer.h
Index: src/zabbix_server/escalator/Makefile.am
===================================================================
--- src/zabbix_server/escalator/Makefile.am	(revision 65451)
+++ src/zabbix_server/escalator/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxescalator.a
 
-libzbxescalator_a_SOURCES = escalator.c escalator.h
+libzbxescalator_a_SOURCES = \
+	escalator.c \
+	escalator.h
Index: src/zabbix_server/housekeeper/Makefile.am
===================================================================
--- src/zabbix_server/housekeeper/Makefile.am	(revision 65451)
+++ src/zabbix_server/housekeeper/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxhousekeeper.a
 
-libzbxhousekeeper_a_SOURCES = housekeeper.c housekeeper.h
+libzbxhousekeeper_a_SOURCES = \
+	housekeeper.c \
+	housekeeper.h
Index: src/zabbix_server/httppoller/Makefile.am
===================================================================
--- src/zabbix_server/httppoller/Makefile.am	(revision 65451)
+++ src/zabbix_server/httppoller/Makefile.am	(working copy)
@@ -3,6 +3,9 @@
 noinst_LIBRARIES = libzbxhttppoller.a
 
 libzbxhttppoller_a_SOURCES = \
-	httpmacro.c httpmacro.h \
-	httptest.c httptest.h \
-	httppoller.c httppoller.h
+	httpmacro.c \
+	httpmacro.h \
+	httppoller.c \
+	httppoller.h \
+	httptest.c \
+	httptest.h
Index: src/zabbix_server/ipmi/Makefile.am
===================================================================
--- src/zabbix_server/ipmi/Makefile.am	(revision 65451)
+++ src/zabbix_server/ipmi/Makefile.am	(working copy)
@@ -3,10 +3,14 @@
 noinst_LIBRARIES = libipmi.a
 
 libipmi_a_SOURCES = \
-	checks_ipmi.c checks_ipmi.h \
-	ipmi_protocol.c ipmi_protocol.h \
-	ipmi_poller.c ipmi_poller.h \
-	ipmi_manager.c ipmi_manager.h \
-	ipmi.c ipmi.h
+	checks_ipmi.c \
+	checks_ipmi.h \
+	ipmi.c \
+	ipmi.h \
+	ipmi_manager.c \
+	ipmi_manager.h \
+	ipmi_poller.c \
+	ipmi_poller.h \
+	ipmi_protocol.c \
+	ipmi_protocol.h
 	
-	
Index: src/zabbix_server/pinger/Makefile.am
===================================================================
--- src/zabbix_server/pinger/Makefile.am	(revision 65451)
+++ src/zabbix_server/pinger/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxpinger.a
 
-libzbxpinger_a_SOURCES = pinger.c pinger.h
+libzbxpinger_a_SOURCES = \
+	pinger.c \
+	pinger.h
Index: src/zabbix_server/poller/Makefile.am
===================================================================
--- src/zabbix_server/poller/Makefile.am	(revision 65451)
+++ src/zabbix_server/poller/Makefile.am	(working copy)
@@ -3,18 +3,37 @@
 noinst_LIBRARIES = libzbxpoller.a
 
 libzbxpoller_a_SOURCES = \
-	checks_agent.c checks_agent.h \
-	checks_internal.c checks_internal.h \
-	checks_simple.c checks_simple.h \
-	checks_simple_vmware.c checks_simple_vmware.h \
-	checks_snmp.c checks_snmp.h \
-	checks_db.c checks_db.h \
-	checks_aggregate.c checks_aggregate.h \
-	checks_external.c checks_external.h \
-	checks_ssh.c checks_ssh.h \
-	checks_telnet.c checks_telnet.h \
-	checks_java.c checks_java.h \
-	checks_calculated.c checks_calculated.h \
-	poller.c poller.h
+	checks_agent.c \
+	checks_agent.h \
+	checks_aggregate.c \
+	checks_aggregate.h \
+	checks_calculated.c \
+	checks_calculated.h \
+	checks_db.c \
+	checks_db.h \
+	checks_external.c \
+	checks_external.h \
+	checks_internal.c \
+	checks_internal.h \
+	checks_java.c \
+	checks_java.h \
+	checks_simple.c \
+	checks_simple.h \
+	checks_simple_vmware.c \
+	checks_simple_vmware.h \
+	checks_snmp.c \
+	checks_snmp.h \
+	checks_ssh.c \
+	checks_ssh.h \
+	checks_telnet.c \
+	checks_telnet.h \
+	poller.c \
+	poller.h
 
-libzbxpoller_a_CFLAGS = -I@top_srcdir@/src/libs/zbxsysinfo/simple -I@top_srcdir@/src/libs/zbxdbcache @UNIXODBC_CFLAGS@ @SNMP_CFLAGS@ @SSH2_CFLAGS@ @OPENIPMI_CFLAGS@
+libzbxpoller_a_CFLAGS = \
+	-I$(top_srcdir)/src/libs/zbxsysinfo/simple \
+	-I$(top_srcdir)/src/libs/zbxdbcache \
+	$(UNIXODBC_CFLAGS) \
+	$(SNMP_CFLAGS) \
+	$(SSH2_CFLAGS) \
+	$(OPENIPMI_CFLAGS)
Index: src/zabbix_server/proxypoller/Makefile.am
===================================================================
--- src/zabbix_server/proxypoller/Makefile.am	(revision 65451)
+++ src/zabbix_server/proxypoller/Makefile.am	(working copy)
@@ -3,5 +3,6 @@
 noinst_LIBRARIES = libzbxproxypoller.a
 
 libzbxproxypoller_a_SOURCES = \
-	proxypoller.c proxypoller.h
+	proxypoller.c \
+	proxypoller.h
 
Index: src/zabbix_server/selfmon/Makefile.am
===================================================================
--- src/zabbix_server/selfmon/Makefile.am	(revision 65451)
+++ src/zabbix_server/selfmon/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxselfmon.a
 
-libzbxselfmon_a_SOURCES = selfmon.c selfmon.h
+libzbxselfmon_a_SOURCES = \
+	selfmon.c \
+	selfmon.h
Index: src/zabbix_server/snmptrapper/Makefile.am
===================================================================
--- src/zabbix_server/snmptrapper/Makefile.am	(revision 65451)
+++ src/zabbix_server/snmptrapper/Makefile.am	(working copy)
@@ -3,4 +3,5 @@
 noinst_LIBRARIES = libzbxsnmptrapper.a
 
 libzbxsnmptrapper_a_SOURCES = \
-	snmptrapper.c snmptrapper.h
+	snmptrapper.c \
+	snmptrapper.h
Index: src/zabbix_server/taskmanager/Makefile.am
===================================================================
--- src/zabbix_server/taskmanager/Makefile.am	(revision 65451)
+++ src/zabbix_server/taskmanager/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxtaskmanager.a
 
-libzbxtaskmanager_a_SOURCES = taskmanager.c taskmanager.h
+libzbxtaskmanager_a_SOURCES = \
+	taskmanager.c \
+	taskmanager.h
Index: src/zabbix_server/timer/Makefile.am
===================================================================
--- src/zabbix_server/timer/Makefile.am	(revision 65451)
+++ src/zabbix_server/timer/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxtimer.a
 
-libzbxtimer_a_SOURCES = timer.c timer.h
+libzbxtimer_a_SOURCES = \
+	timer.c \
+	timer.h
Index: src/zabbix_server/trapper/Makefile.am
===================================================================
--- src/zabbix_server/trapper/Makefile.am	(revision 65451)
+++ src/zabbix_server/trapper/Makefile.am	(working copy)
@@ -3,11 +3,19 @@
 noinst_LIBRARIES = libzbxtrapper.a
 
 libzbxtrapper_a_SOURCES = \
-	active.c active.h \
-	trapper.c trapper.h \
-	nodecommand.c nodecommand.h \
-	proxyconfig.c proxyconfig.h \
-	proxydiscovery.c proxydiscovery.h \
-	proxyautoreg.c proxyautoreg.h \
-	proxyhosts.c proxyhosts.h \
-	proxydata.c proxydata.h
+	active.c \
+	active.h \
+	nodecommand.c \
+	nodecommand.h \
+	proxyautoreg.c \
+	proxyautoreg.h \
+	proxyconfig.c \
+	proxyconfig.h \
+	proxydata.c \
+	proxydata.h \
+	proxydiscovery.c \
+	proxydiscovery.h \
+	proxyhosts.c \
+	proxyhosts.h \
+	trapper.c \
+	trapper.h
Index: src/zabbix_server/vmware/Makefile.am
===================================================================
--- src/zabbix_server/vmware/Makefile.am	(revision 65451)
+++ src/zabbix_server/vmware/Makefile.am	(working copy)
@@ -2,6 +2,8 @@
 
 noinst_LIBRARIES = libzbxvmware.a
 
-libzbxvmware_a_SOURCES = vmware.c vmware.h
+libzbxvmware_a_SOURCES = \
+	vmware.c \
+	vmware.h
 
-libzbxvmware_a_CFLAGS = @LIBXML2_CFLAGS@
+libzbxvmware_a_CFLAGS = $(LIBXML2_CFLAGS)
Index: src/zabbix_server/watchdog/Makefile.am
===================================================================
--- src/zabbix_server/watchdog/Makefile.am	(revision 65451)
+++ src/zabbix_server/watchdog/Makefile.am	(working copy)
@@ -2,4 +2,6 @@
 
 noinst_LIBRARIES = libzbxwatchdog.a
 
-libzbxwatchdog_a_SOURCES = watchdog.c watchdog.h
+libzbxwatchdog_a_SOURCES = \
+	watchdog.c \
+	watchdog.h
