Skip to content

Commit cd56990

Browse files
committed
build: use non-recursive automake
This is a huge change, one that cannot be sensibly broken up into smaller pieces, so please bear with me! The purpose of the complete rewrite of the build system is to get rid of recursive make calls, and instead, use a single, non-recursive Makefile built up from multiple included parts, that has all the dependency information, therefore providing a much more robust dependency tracking, which is also significantly faster. For the sake of convenience, the Mk/populater-makefiles.sh script will add wrapper Makefiles to every directory that has a Makefile.am (unless it belongs to a third party library), allowing one to restrict 'make all' and 'make check' to a particular directory. The 'make check' provided by this convenience Makefile does not recurse into subdirectories, however. The system also provides shortcuts to build various parts of syslog-ng: - make syslog-ng - make mod-sql mod-mongodb mod-socket - etc Signed-off-by: Gergely Nagy <algernon@balabit.hu> Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
1 parent 4c5a4d0 commit cd56990

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1469
-913
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ m4/ltoptions.m4
3333
m4/ltsugar.m4
3434
m4/ltversion.m4
3535
m4/pkg.m4
36-
37-
!lib/logproto/Makefile.in
36+
/compile
37+
.deps

Makefile.am

+82-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,88 @@
1-
SUBDIRS = libtest lib modules syslog-ng scripts tests doc contrib scl debian tgz2build build
1+
SUBDIRS =
2+
AM_MAKEFLAGS = --no-print-directory
23

3-
ACLOCAL_AMFLAGS = -I m4 --install
4+
ACLOCAL_AMFLAGS = -I m4 --install
45

5-
EXTRA_DIST = VERSION \
6-
syslog-ng.spec syslog-ng.spec.in dist.conf dist.conf.in ChangeLog syslog-ng.pc.in
6+
EXTRA_DIST = ${BUILT_SOURCES} VERSION \
7+
syslog-ng.spec syslog-ng.spec.in \
8+
dist.conf dist.conf.in syslog-ng.pc.in \
9+
${top_srcdir}/ChangeLog
710

8-
pkgconfigdir = $(libdir)/pkgconfig
9-
pkgconfig_DATA = syslog-ng.pc
11+
pkgconfigdir = $(libdir)/pkgconfig
12+
pkgconfig_DATA = syslog-ng.pc
1013

11-
.PHONY: ChangeLog
14+
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/modules -I$(top_builddir)/lib -I$(top_builddir)/modules
15+
TEST_CFLAGS = -I$(top_srcdir)/libtest
16+
TEST_LDADD = $(top_builddir)/lib/libsyslog-ng.la \
17+
$(top_builddir)/libtest/libsyslog-ng-test.a \
18+
$(TOOL_DEPS_LIBS)
1219

13-
ChangeLog:
20+
export top_srcdir
21+
22+
CLEAN_SUBDIRS =
23+
24+
clean-local:
25+
${AM_v_at}for dir in ${CLEAN_SUBDIRS}; do \
26+
[ -f $${dir}/Makefile ] && ${MAKE} -C $${dir} clean || true; \
27+
done
28+
29+
local-check:
30+
${AM_v_at}${MAKE} check check_PROGRAMS="${${check_subdir}_TESTS}" TESTS="${${check_subdir}_TESTS}"
31+
32+
noinst_LIBRARIES =
33+
noinst_DATA =
34+
noinst_LTLIBRARIES =
35+
lib_LTLIBRARIES =
36+
pkginclude_HEADERS =
37+
module_LTLIBRARIES =
38+
BUILT_SOURCES =
39+
CLEANFILES = $(BUILT_SOURCES)
40+
check_PROGRAMS =
41+
TESTS = $(check_PROGRAMS)
42+
bin_SCRIPTS =
43+
bin_PROGRAMS =
44+
sbin_PROGRAMS =
45+
libexec_PROGRAMS =
46+
man_MANS =
47+
48+
INSTALL_EXEC_HOOKS =
49+
50+
AUTOMAKE_OPTIONS = subdir-objects
51+
52+
${top_srcdir}/ChangeLog:
1453
(cd $(top_srcdir); git log) > $@
15-
54+
55+
install-exec-hook: ${INSTALL_EXEC_HOOKS}
56+
57+
help:
58+
@echo "Welcome to the syslog-ng build system!"
59+
@echo
60+
@echo "All of the standard targets are available:"
61+
@echo " all, check, install, dist, distcheck, and clean"
62+
@echo
63+
@echo "Apart from these, the build system supports various other,"
64+
@echo "special targets:"
65+
@echo
66+
@echo " modules : Builds all syslog-ng modules."
67+
@echo " syslog-ng: Build syslog-ng itself, only."
68+
@echo
69+
@echo "One can also build individual modules (and their dependencies),"
70+
@echo "using any of the following shortcuts:"
71+
@echo
72+
@echo "" ${SYSLOG_NG_MODULES} | sed -e 's#\(.\{,72\}\) #\1\n #g'
73+
74+
.PHONY: help
75+
76+
include Mk/lex-rules.am
77+
include libtest/Makefile.am
78+
include lib/Makefile.am
79+
include modules/Makefile.am
80+
include syslog-ng/Makefile.am
81+
include scripts/Makefile.am
82+
include tests/Makefile.am
83+
include doc/Makefile.am
84+
include contrib/Makefile.am
85+
include scl/Makefile.am
86+
include debian/Makefile.am
87+
include tgz2build/Makefile.am
88+
include Mk/Makefile.am

Mk/Makefile.am

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
EXTRA_DIST += Mk/lex-rules.am
2+
3+
toolsdir = $(datadir)/tools
4+
tools_DATA = \
5+
Mk/lex-rules.am \
6+
lib/cfg-grammar.y \
7+
lib/merge-grammar.pl

Mk/find-top-builddir.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
3+
while ! test -f config.status || test "$(pwd)" = "/"; do
4+
cd ..
5+
done
6+
7+
pwd

Mk/lex-rules.am

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
%.y: %.ym $(top_srcdir)/lib/merge-grammar.pl $(top_srcdir)/lib/cfg-grammar.y
2+
$(AM_V_GEN) $(top_srcdir)/lib/merge-grammar.pl $< > $@
3+
4+
.l.c:
5+
$(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $*.c $(LEX_OUTPUT_ROOT).h $*.h -- $(LEXCOMPILE) | ($(EGREP) -v "^updating" || true)
6+
7+
.l.h:
8+
$(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $*.c $(LEX_OUTPUT_ROOT).h $*.h -- $(LEXCOMPILE) | ($(EGREP) -v "^updating" || true)
9+
10+
.y.c:
11+
$(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) 2>&1 | ($(EGREP) -v "(warning: ([0-9]+ )?(nonterminal|rule)s? useless in grammar)|(^updating)" || true)
12+
13+
.y.h:
14+
$(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) 2>&1 | ($(EGREP) -v "(warning: ([0-9]+ )?(nonterminal|rule)s? useless in grammar)|(^updating)" || true)

Mk/populate-makefiles.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /bin/sh
2+
3+
root=$(cd $(dirname $0) && cd .. && pwd)
4+
5+
populate() {
6+
mfam="$1"
7+
dir="$(dirname ${mfam})"
8+
if [ "${dir}" != "." ] && [ "${dir}" != "${root}" ] && [ -d "${dir}" ]; then
9+
echo "${root}/Mk/subdir.mk" "=>" "${dir}/Makefile"
10+
ln -sf "${root}/Mk/subdir.mk" "${dir}/Makefile"
11+
fi
12+
if [ -e "${root}/${dir}/Makefile.am" ]; then
13+
incs=$(grep "^include" "${root}/${dir}/Makefile.am" | sed -e "s,^include ,,")
14+
for inc in ${incs}; do
15+
populate "${inc}"
16+
done
17+
fi
18+
}
19+
20+
populate ./Makefile.am

Mk/subdir.mk

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
top_srcdir = $(dir $(shell readlink ${MAKEFILE_LIST}))../
2+
top_builddir = $(shell ${top_srcdir}/Mk/find-top-builddir.sh)
3+
4+
self = $(subst ${top_builddir}/,,${CURDIR})
5+
self_sub = $(subst -,_,$(subst /,_,${self}))
6+
7+
all:
8+
${AM_v_at}${MAKE} -C ${top_builddir} ${self}/
9+
10+
check:
11+
${AM_v_at}${MAKE} -C ${top_builddir} local-check check_subdir=${self_sub}
12+
13+
clean dist distcheck:
14+
${AM_v_at}${MAKE} -C ${top_builddir} $@
15+
16+
%:
17+
${AM_v_at}${MAKE} -C ${top_builddir} ${self}/$@

build/Makefile.am

-5
This file was deleted.

build/emulate-make-in-automakeless-dirs.in

-10
This file was deleted.

build/lex-rules.am

-14
This file was deleted.

configure.ac

+12-54
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ else
5353
CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
5454
fi
5555

56-
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, [no-define subdir-objects])
56+
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, [foreign no-define subdir-objects])
5757
_AM_PROG_TAR([ustar])
5858
if test -n "$SNAPSHOT_VERSION"; then
5959
VERSION=$VERSION+$SNAPSHOT_VERSION
@@ -229,6 +229,7 @@ dnl Checks for programs.
229229
AC_PROG_CC
230230
AM_PROG_CC_STDC
231231
AC_PROG_CC_C99
232+
AM_PROG_CC_C_O
232233
if test "x$ac_cv_prog_cc_c99" = "xno"; then
233234
AC_MSG_ERROR("C99 standard compliant C compiler required. Try GCC 3.x or later.")
234235
fi
@@ -787,7 +788,7 @@ if test "x$with_ivykis" = "xinternal"; then
787788

788789
IVYKIS_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis/src -livykis -Wl,--no-whole-archive"
789790
IVYKIS_CFLAGS="-I\$(top_srcdir)/lib/ivykis/src/include -I\$(top_builddir)/lib/ivykis/src/include"
790-
IVYKIS_SUBDIRS=ivykis
791+
IVYKIS_SUBDIRS=lib/ivykis
791792

792793
# LIBS to use when libtool is not applicable (when linking the main syslog-ng executable in mixed linking mode)
793794
IVYKIS_NO_LIBTOOL_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis/src/.libs -livykis -Wl,--no-whole-archive"
@@ -816,9 +817,9 @@ if test "x$with_libmongo_client" = "xinternal"; then
816817
# these can only be used in modules/mongodb as it assumes
817818
# the current directory just one below libmongo-client
818819

819-
LIBMONGO_LIBS="-L\$(builddir)/libmongo-client/src -lmongo-client $OPENSSL_LIBS"
820-
LIBMONGO_CFLAGS="-I\$(srcdir)/libmongo-client/src"
821-
LIBMONGO_SUBDIRS="libmongo-client"
820+
LIBMONGO_LIBS="-L\$(top_builddir)/modules/afmongodb/libmongo-client/src -lmongo-client $OPENSSL_LIBS"
821+
LIBMONGO_CFLAGS="-I\$(top_srcdir)/modules/afmongodb/libmongo-client/src"
822+
LIBMONGO_SUBDIRS="modules/afmongodb/libmongo-client"
822823
else
823824
AC_MSG_WARN([Internal libmongo-client sources not found in modules/afmongodb/libmongo-client])
824825
with_libmongo_client="no"
@@ -872,9 +873,9 @@ if test "x$with_librabbitmq_client" = "xinternal"; then
872873
# these can only be used in modules/amqp as it assumes
873874
# the current directory just one below rabbitmq-c
874875

875-
LIBRABBITMQ_LIBS="-L\$(builddir)/rabbitmq-c/librabbitmq -lrabbitmq"
876-
LIBRABBITMQ_CFLAGS="-I\$(srcdir)/rabbitmq-c/librabbitmq -I\$(builddir)/rabbitmq-c/librabbitmq"
877-
LIBRABBITMQ_SUBDIRS="rabbitmq-c"
876+
LIBRABBITMQ_LIBS="-L\$(top_builddir)/modules/afamqp/rabbitmq-c/librabbitmq -lrabbitmq"
877+
LIBRABBITMQ_CFLAGS="-I\$(top_srcdir)/modules/afamqp/rabbitmq-c/librabbitmq -I\$(top_builddir)/modules/afamqp/rabbitmq-c/librabbitmq"
878+
LIBRABBITMQ_SUBDIRS="modules/afamqp/rabbitmq-c"
878879
else
879880
AC_MSG_WARN([Internal librabbitmq-client sources not found in modules/afamqp/rabbitmq-c])
880881
with_librabbitmq_client="no"
@@ -1153,6 +1154,9 @@ AM_CONDITIONAL(ENABLE_AMQP, [test "$enable_amqp" = "yes"])
11531154
AM_CONDITIONAL(ENABLE_JSON, [test "$enable_json" = "yes"])
11541155
AM_CONDITIONAL(ENABLE_GEOIP, [test "$enable_geoip" = "yes"])
11551156
AM_CONDITIONAL(WITH_EMBEDDED_CRYPTO, [test "$with_embedded_crypto" = "yes"])
1157+
AM_CONDITIONAL(IVYKIS_INTERNAL, [test "x$IVYKIS_SUBDIRS" != "x"])
1158+
AM_CONDITIONAL(LIBMONGO_INTERNAL, [test "x$LIBMONGO_SUBDIRS" != "x"])
1159+
AM_CONDITIONAL(LIBRABBITMQ_INTERNAL, [test "x$LIBRABBITMQ_SUBDIRS" != "x"])
11561160

11571161
# substitution into manual pages
11581162
expanded_sysconfdir=[`patheval $sysconfdir | sed -e 's/-/\\\\-/g'`]
@@ -1206,53 +1210,7 @@ AC_OUTPUT(dist.conf
12061210
Makefile
12071211
syslog-ng.spec
12081212
syslog-ng.pc
1209-
build/Makefile
1210-
lib/Makefile
1211-
lib/logproto/Makefile
1212-
lib/logproto/tests/Makefile
1213-
lib/tests/Makefile
1214-
libtest/Makefile
1215-
syslog-ng/Makefile
1216-
modules/Makefile
1217-
modules/afsocket/Makefile
1218-
modules/afsocket/tests/Makefile
1219-
modules/afsql/Makefile
1220-
modules/afstreams/Makefile
1221-
modules/affile/Makefile
1222-
modules/afprog/Makefile
1223-
modules/afuser/Makefile
1224-
modules/afmongodb/Makefile
1225-
modules/afsmtp/Makefile
1226-
modules/afamqp/Makefile
1227-
modules/dbparser/Makefile
1228-
modules/dbparser/pdbtool/Makefile
1229-
modules/dbparser/tests/Makefile
1230-
modules/csvparser/Makefile
1231-
modules/csvparser/tests/Makefile
1232-
modules/confgen/Makefile
1233-
modules/system-source/Makefile
1234-
modules/syslogformat/Makefile
1235-
modules/linux-kmsg-format/Makefile
1236-
modules/linux-kmsg-format/tests/Makefile
1237-
modules/pacctformat/Makefile
1238-
modules/basicfuncs/Makefile
1239-
modules/basicfuncs/tests/Makefile
1240-
modules/cryptofuncs/Makefile
1241-
modules/cryptofuncs/tests/Makefile
1242-
modules/json/Makefile
1243-
modules/json/tests/Makefile
1244-
modules/tfgeoip/Makefile
1245-
scripts/Makefile
12461213
scripts/update-patterndb
1247-
doc/Makefile
1248-
contrib/Makefile
1249-
scl/Makefile
1250-
tests/Makefile
1251-
debian/Makefile
1252-
tgz2build/Makefile
1253-
tests/unit/Makefile
1254-
tests/functional/Makefile
1255-
tests/loggen/Makefile
12561214
)
12571215

12581216
echo

0 commit comments

Comments
 (0)