Commit a81d0b711354a9eb2621d67d3a47c2ae5cf33b9e

Guillem Jover 2024-02-11T23:55:40

build: Sort variables and their contents in automake files This should make it easier to add new entries, and find them afterwards.

diff --git a/man/Makefile.am b/man/Makefile.am
index 4fe372a..51cbdd7 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -243,48 +243,40 @@ dist_man_MANS += \
 	# EOL
 endif
 
-if NEED_PROGNAME
-dist_man_MANS += \
-	getprogname.3bsd \
-	setprogname.3bsd \
-	# EOL
-endif
-
-if NEED_MD5
+if NEED_FPURGE
 dist_man_MANS += \
-	md5.3bsd \
+	fpurge.3bsd \
 	# EOL
 endif
 
-if NEED_NLIST
+if NEED_FUNOPEN
 dist_man_MANS += \
-	nlist.3bsd \
+	funopen.3bsd \
 	# EOL
 endif
 
-if NEED_STRL
+if NEED_MD5
 dist_man_MANS += \
-	strlcat.3bsd \
-	strlcpy.3bsd \
+	md5.3bsd \
 	# EOL
 endif
 
-if NEED_WCSL
+if NEED_NLIST
 dist_man_MANS += \
-	wcslcat.3bsd \
-	wcslcpy.3bsd \
+	nlist.3bsd \
 	# EOL
 endif
 
-if NEED_STRMODE
+if NEED_PROGNAME
 dist_man_MANS += \
-	strmode.3bsd \
+	getprogname.3bsd \
+	setprogname.3bsd \
 	# EOL
 endif
 
 dist_man_MANS += \
-	uid_from_user.3bsd \
 	gid_from_group.3bsd \
+	uid_from_user.3bsd \
 	# EOL
 
 if NEED_NAME_FROM_ID
@@ -294,14 +286,22 @@ dist_man_MANS += \
 	# EOL
 endif
 
-if NEED_FPURGE
+if NEED_STRL
 dist_man_MANS += \
-	fpurge.3bsd \
+	strlcat.3bsd \
+	strlcpy.3bsd \
 	# EOL
 endif
 
-if NEED_FUNOPEN
+if NEED_STRMODE
 dist_man_MANS += \
-	funopen.3bsd \
+	strmode.3bsd \
+	# EOL
+endif
+
+if NEED_WCSL
+dist_man_MANS += \
+	wcslcat.3bsd \
+	wcslcpy.3bsd \
 	# EOL
 endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 67a01df..b4ec241 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,44 +113,50 @@ libbsd_la_SOURCES = \
 	vis.c \
 	# EOL
 
-if NEED_ERR
+if NEED_ARC4RANDOM
+if !HAVE_GETENTROPY
 libbsd_la_SOURCES += \
-	err.c \
+	getentropy.c \
+	# EOL
+endif
+libbsd_la_SOURCES += \
+	arc4random.c \
+	arc4random.h \
+	arc4random_linux.h \
+	arc4random_uniform.c \
+	arc4random_unix.h \
+	arc4random_win.h \
+	chacha_private.h \
 	# EOL
 endif
 
-if NEED_ERRC
+if NEED_BSD_GETOPT
 libbsd_la_SOURCES += \
-	errc.c \
+	bsd_getopt.c \
 	# EOL
 endif
 
-if NEED_PROGNAME
+if NEED_ERR
 libbsd_la_SOURCES += \
-	progname.c \
+	err.c \
 	# EOL
 endif
 
-if NEED_BSD_GETOPT
+if NEED_ERRC
 libbsd_la_SOURCES += \
-	bsd_getopt.c \
+	errc.c \
 	# EOL
 endif
 
-if NEED_ARC4RANDOM
-if !HAVE_GETENTROPY
+if NEED_FPURGE
 libbsd_la_SOURCES += \
-	getentropy.c \
+	fpurge.c \
 	# EOL
 endif
+
+if NEED_FUNOPEN
 libbsd_la_SOURCES += \
-	arc4random.c \
-	arc4random.h \
-	arc4random_linux.h \
-	arc4random_uniform.c \
-	arc4random_unix.h \
-	arc4random_win.h \
-	chacha_private.h \
+	funopen.c \
 	# EOL
 endif
 
@@ -166,17 +172,16 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
-if NEED_STRL
+if NEED_PROGNAME
 libbsd_la_SOURCES += \
-	strlcat.c \
-	strlcpy.c \
+	progname.c \
 	# EOL
 endif
 
-if NEED_WCSL
+if NEED_STRL
 libbsd_la_SOURCES += \
-	wcslcat.c \
-	wcslcpy.c \
+	strlcat.c \
+	strlcpy.c \
 	# EOL
 endif
 
@@ -186,15 +191,10 @@ libbsd_la_SOURCES += \
 	# EOL
 endif
 
-if NEED_FPURGE
-libbsd_la_SOURCES += \
-	fpurge.c \
-	# EOL
-endif
-
-if NEED_FUNOPEN
+if NEED_WCSL
 libbsd_la_SOURCES += \
-	funopen.c \
+	wcslcat.c \
+	wcslcpy.c \
 	# EOL
 endif
 
diff --git a/test/Makefile.am b/test/Makefile.am
index 459012c..7b53bc1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -49,21 +49,27 @@ check_PROGRAMS = \
 	vis-openbsd \
 	# EOL
 
-if NEED_PROGNAME
-check_PROGRAMS += progname
-endif
+if NEED_ARC4RANDOM
+if HAVE_LIBTESTU01
+check_PROGRAMS += arc4random
 
-if NEED_NLIST
-check_PROGRAMS += nlist
+arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
 endif
-
-if NEED_STRL
-check_PROGRAMS += strl
 endif
 
-if NEED_STRMODE
-check_PROGRAMS += strmode
-endif
+fgetln_SOURCES = \
+	test-stream.c \
+	test-stream.h \
+	fgetln.c \
+	# EOL
+
+fgetln_CFLAGS = -Wno-deprecated-declarations
+
+fparseln_SOURCES = \
+	test-stream.c \
+	test-stream.h \
+	fparseln.c \
+	# EOL
 
 if NEED_FPURGE
 check_PROGRAMS += fpurge
@@ -73,38 +79,45 @@ if NEED_FUNOPEN
 check_PROGRAMS += funopen
 endif
 
-if NEED_ARC4RANDOM
-if HAVE_LIBTESTU01
-arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
+if NEED_MD5
+check_PROGRAMS += md5
 
-check_PROGRAMS += arc4random
+if NEED_TRANSPARENT_LIBMD
+# On the installed system this is handled via the ld script.
+md5_LDADD = $(LDADD) $(MD5_LIBS)
 endif
 endif
 
+if NEED_NLIST
+check_PROGRAMS += nlist
+endif
+
+proctitle_init_SOURCES = \
+	proctitle.c \
+	# EOL
+
+proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
+
 if BUILD_LIBBSD_CTOR
+check_PROGRAMS += proctitle
+
 proctitle_LDFLAGS = \
 	-Wl,-u,libbsd_init_func \
 	$(top_builddir)/src/libbsd-ctor.a \
 	$(top_builddir)/src/libbsd.la \
 	# EOL
-
-check_PROGRAMS += proctitle
 endif
 
-if NEED_MD5
-check_PROGRAMS += md5
-
-if NEED_TRANSPARENT_LIBMD
-# On the installed system this is handled via the ld script.
-md5_LDADD = $(LDADD) $(MD5_LIBS)
-endif
+if NEED_PROGNAME
+check_PROGRAMS += progname
 endif
 
-fgetln_SOURCES = test-stream.c test-stream.h fgetln.c
-fgetln_CFLAGS = -Wno-deprecated-declarations
-fparseln_SOURCES = test-stream.c test-stream.h fparseln.c
+if NEED_STRL
+check_PROGRAMS += strl
+endif
 
-proctitle_init_SOURCES = proctitle.c
-proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
+if NEED_STRMODE
+check_PROGRAMS += strmode
+endif
 
 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)