From ea89644bfa81b1277c96bbb7cacf4ed3ca9f94f9 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 4 May 2019 23:00:48 +0200 Subject: [PATCH 1/4] Ensure the library is built before the samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building in parallel, Make can start building the samples before it’s finished building the library, which causes the build to fail. Adding an explicit dependency ensures that the library is built before the samples. Signed-off-by: Stephen Kitt --- nufxlib/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nufxlib/Makefile.in b/nufxlib/Makefile.in index cf5d15d..c64bb59 100644 --- a/nufxlib/Makefile.in +++ b/nufxlib/Makefile.in @@ -69,7 +69,7 @@ install-shared: $(SHARED_PRODUCT) $(srcdir)/mkinstalldirs $(includedir) $(INSTALL_DATA) NufxLib.h $(includedir) -samples:: +samples:: $(STATIC_PRODUCT) @echo "Building samples..." @(cd samples; set +e; unset CFLAGS OBJS; set -e; \ @SET_MAKE@ LIB_PRODUCT="../$(PRODUCT)" $(MAKE)) From f6ff60420b41925ea411bb9428ff88a9fb5c4549 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 4 May 2019 23:02:16 +0200 Subject: [PATCH 2/4] Add AC_DEFINE descriptions This allows current autoheader to process configure.in, preserving the comments in config.h.in. Signed-off-by: Stephen Kitt --- nufxlib/configure.in | 18 +++++++++--------- nulib2/configure.in | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nufxlib/configure.in b/nufxlib/configure.in index 46df1a4..50ed072 100644 --- a/nufxlib/configure.in +++ b/nufxlib/configure.in @@ -42,7 +42,7 @@ AC_CACHE_VAL(nufxlib_cv_snprintf_in_header, [ [nufxlib_cv_snprintf_in_header=no]) ]) if test $nufxlib_cv_snprintf_in_header = "yes"; then - AC_DEFINE(SNPRINTF_DECLARED) + AC_DEFINE(SNPRINTF_DECLARED, [], [Define it SNPRINTF is declared in stdio.h.]) fi AC_MSG_RESULT($nufxlib_cv_snprintf_in_header) @@ -54,7 +54,7 @@ AC_CACHE_VAL(nufxlib_cv_vsnprintf_in_header, [ [nufxlib_cv_vsnprintf_in_header=no]) ]) if test $nufxlib_cv_vsnprintf_in_header = "yes"; then - AC_DEFINE(VSNPRINTF_DECLARED) + AC_DEFINE(VSNPRINTF_DECLARED, [], [Define if VSNPRINTF is declared in stdio.h.]) fi AC_MSG_RESULT($nufxlib_cv_vsnprintf_in_header) @@ -138,7 +138,7 @@ AC_CACHE_VAL(nufxlib_cv_sprintf_returns_int, [ ]) if test $nufxlib_cv_sprintf_returns_int = "yes"; then - AC_DEFINE(SPRINTF_RETURNS_INT) + AC_DEFINE(SPRINTF_RETURNS_INT, [], [Define if sprintf returns an int.]) fi AC_MSG_RESULT($nufxlib_cv_sprintf_returns_int) @@ -155,21 +155,21 @@ AC_ARG_ENABLE(sq, [ --disable-sq disable SQ compression], [ ], [ enable_sq=yes ]) if test $enable_sq = "yes"; then - AC_DEFINE(ENABLE_SQ) + AC_DEFINE(ENABLE_SQ, [], [Define to include SQ (Huffman+RLE) compression.]) fi AC_ARG_ENABLE(lzw, [ --disable-lzw disable LZW/1 and LZW/2 compression], [ ], [ enable_lzw=yes ]) if test $enable_lzw = "yes"; then - AC_DEFINE(ENABLE_LZW) + AC_DEFINE(ENABLE_LZW, [], [Define to include LZW (ShrinkIt LZW/1 and LZW/2) compression.]) fi AC_ARG_ENABLE(lzc, [ --disable-lzc disable 12- and 16-bit LZC compression], [ ], [ enable_lzc=yes ]) if test $enable_lzc = "yes"; then - AC_DEFINE(ENABLE_LZC) + AC_DEFINE(ENABLE_LZC, [], [Define to include LZC (12-bit and 16-bit UNIX "compress") compression.]) fi AC_ARG_ENABLE(deflate, @@ -184,7 +184,7 @@ if test $enable_deflate = "yes"; then fi if $got_zlibh; then echo " (found libz and zlib.h, enabling deflate)" - AC_DEFINE(ENABLE_DEFLATE) + AC_DEFINE(ENABLE_DEFLATE, [], [Define to include deflate (zlib) compression (also need -l in Makefile).]) else echo " (couldn't find libz and zlib.h, not enabling deflate)" fi @@ -204,7 +204,7 @@ if test $enable_bzip2 = "yes"; then fi if $got_bzlibh; then echo " (found libbz2 and bzlib.h, enabling bzip2)" - AC_DEFINE(ENABLE_BZIP2) + AC_DEFINE(ENABLE_BZIP2, [], [Define to include bzip2 (libbz2) compression (also need -l in Makefile).]) else echo " (couldn't find libbz2 and bzlib.h, not enabling bzip2)" fi @@ -213,6 +213,6 @@ fi AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc do dmalloc stuff], [ echo "--- enabling dmalloc"; - LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC) ]) + LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC, [], [Define if we want to use the dmalloc library (also need -l in Makefile).]) ]) AC_OUTPUT(Makefile samples/Makefile) diff --git a/nulib2/configure.in b/nulib2/configure.in index 38f13f5..ab67c42 100644 --- a/nulib2/configure.in +++ b/nulib2/configure.in @@ -47,7 +47,7 @@ if test $enable_deflate = "yes"; then fi if $got_zlibh; then echo " (found libz and zlib.h, enabling deflate)" - AC_DEFINE(ENABLE_DEFLATE) + AC_DEFINE(ENABLE_DEFLATE, [], [Define to include deflate (zlib) compresion (also need -l in Makefile).]) else echo " (couldn't find libz and zlib.h, not enabling deflate)" fi @@ -67,7 +67,7 @@ if test $enable_bzip2 = "yes"; then fi if $got_bzlibh; then echo " (found libbz2 and bzlib.h, enabling bzip2)" - AC_DEFINE(ENABLE_BZIP2) + AC_DEFINE(ENABLE_BZIP2, [], [Define to include bzip2 (libbz2) compression (also need -l in Makefile).]) else echo " (couldn't find libbz2 and bzlib.h, not enabling bzip2)" fi @@ -138,6 +138,6 @@ AC_SUBST(BUILD_FLAGS) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc do dmalloc stuff], \ [ echo "--- enabling dmalloc"; - LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC) ]) + LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC, [], [Define if we want to use the dmalloc library (also need -l in Makefile).]) ]) AC_OUTPUT(Makefile) From 21a10ad26666d25168cec065b9d2a3d4c0a8aa10 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 4 May 2019 23:02:54 +0200 Subject: [PATCH 3/4] Install to DESTDIR Packaging systems commonly specify DESTDIR as a temporary directory in which to install the build artifacts. Its use is transparent in other contexts. Signed-off-by: Stephen Kitt --- nulib2/Makefile.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nulib2/Makefile.in b/nulib2/Makefile.in index e0cf9fd..948c6bd 100644 --- a/nulib2/Makefile.in +++ b/nulib2/Makefile.in @@ -63,10 +63,10 @@ all: $(PRODUCT) @true install: $(PRODUCT) - $(srcdir)/mkinstalldirs $(bindir) - $(INSTALL_PROGRAM) $(PRODUCT) $(bindir) - $(srcdir)/mkinstalldirs $(mandir)/man1 - $(INSTALL_DATA) nulib2.1 $(mandir)/man1/ + $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) $(PRODUCT) $(DESTDIR)$(bindir) + $(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)/man1 + $(INSTALL_DATA) nulib2.1 $(DESTDIR)$(mandir)/man1/ install-shared: LIB_PRODUCT="libnufx.so" $(MAKE) -e install From 7ec4eb46c79879838c9ed9e877f49f18efef7e33 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Sat, 4 May 2019 23:04:46 +0200 Subject: [PATCH 4/4] Honour LDFLAGS when linking Most of the build handles flags fine, since it uses the built-in Make rules. However the linking step ignores LDFLAGS, which means some link flags used in Linux distributions are ignored. Signed-off-by: Stephen Kitt --- nulib2/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nulib2/Makefile.in b/nulib2/Makefile.in index 948c6bd..b247e97 100644 --- a/nulib2/Makefile.in +++ b/nulib2/Makefile.in @@ -79,7 +79,7 @@ shared:: LIB_PRODUCT="libnufx.so" $(MAKE) -e $(PRODUCT): $(OBJS) $(NUFXLIB) - $(CC) -o $@ $(OBJS) -L$(NUFXSRCDIR) -L$(libdir) -lnufx @LIBS@ + $(CC) $(LDFLAGS) -o $@ $(OBJS) -L$(NUFXSRCDIR) -L$(libdir) -lnufx @LIBS@ clean: -rm -f *.o core