[PATCH] Out-of-tree build for libmd

Gregor Jasny gjasny at googlemail.com
Fri Oct 27 19:55:25 UTC 2023


Hello,

while working on a Conan recipe for libmd I noticed that libmd has 
problems building when the build directory is not equal to the source 
directory:

>   GEN      rmd160hl.c
> /bin/sed: can't read helper.c: No such file or directory

The attached patch fixes the problem for me.

Thanks,
Gregor
-------------- next part --------------
From ec414c0ffda581c7bb60c37f0deca248d560d869 Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gjasny at googlemail.com>
Date: Fri, 27 Oct 2023 14:25:18 +0200
Subject: [PATCH] build: fix out-of-tree build

---
 src/Makefile.am | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index d32f52f..ac01ca4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,39 +83,39 @@ libmd.sym: libmd.map
 	$(AM_V_GEN) $(SED) -ne 's/^[[:space:]]\{1,\}\([A-Za-z0-9_]\{1,\}\);/\1/p' libmd.map > $@
 
 md2hl.c: helper.c
-	$(AM_V_GEN) $(SED) -e 's/hashinc/md2.h/g' -e 's/HASH/MD2/g' helper.c > $@
+	$(AM_V_GEN) $(SED) -e 's/hashinc/md2.h/g' -e 's/HASH/MD2/g' "$(srcdir)/helper.c" > $@
 
 md4hl.c: helper.c
-	$(AM_V_GEN) $(SED) -e 's/hashinc/md4.h/g' -e 's/HASH/MD4/g' helper.c > $@
+	$(AM_V_GEN) $(SED) -e 's/hashinc/md4.h/g' -e 's/HASH/MD4/g' "$(srcdir)/helper.c" > $@
 
 md5hl.c: helper.c
-	$(AM_V_GEN) $(SED) -e 's/hashinc/md5.h/g' -e 's/HASH/MD5/g' helper.c > $@
+	$(AM_V_GEN) $(SED) -e 's/hashinc/md5.h/g' -e 's/HASH/MD5/g' "$(srcdir)/helper.c" > $@
 
 rmd160hl.c: helper.c
-	$(AM_V_GEN) $(SED) -e 's/hashinc/rmd160.h/g' -e 's/HASH/RMD160/g' helper.c > $@
+	$(AM_V_GEN) $(SED) -e 's/hashinc/rmd160.h/g' -e 's/HASH/RMD160/g' "$(srcdir)/helper.c" > $@
 
 sha1hl.c: helper.c
-	$(AM_V_GEN) $(SED) -e 's/hashinc/sha1.h/g' -e 's/HASH/SHA1/g' helper.c > $@
+	$(AM_V_GEN) $(SED) -e 's/hashinc/sha1.h/g' -e 's/HASH/SHA1/g' "$(srcdir)/helper.c" > $@
 
 sha224hl.c: helper.c
 	$(AM_V_GEN) $(SED) -e 's/hashinc/sha2.h/g' -e 's/HASH/SHA224/g' \
-	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' helper.c > $@
+	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' "$(srcdir)/helper.c" > $@
 
 sha256hl.c: helper.c
 	$(AM_V_GEN) $(SED) -e 's/hashinc/sha2.h/g' -e 's/HASH/SHA256/g' \
-	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' helper.c > $@
+	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' "$(srcdir)/helper.c" > $@
 
 sha384hl.c: helper.c
 	$(AM_V_GEN) $(SED) -e 's/hashinc/sha2.h/g' -e 's/HASH/SHA384/g' \
-	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' helper.c > $@
+	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' "$(srcdir)/helper.c" > $@
 
 sha512hl.c: helper.c
 	$(AM_V_GEN) $(SED) -e 's/hashinc/sha2.h/g' -e 's/HASH/SHA512/g' \
-	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' helper.c > $@
+	                -e 's/SHA[0-9][0-9][0-9]_CTX/SHA2_CTX/g' "$(srcdir)/helper.c" > $@
 
 sha512_256hl.c: helper.c
 	$(AM_V_GEN) $(SED) -e 's/hashinc/sha2.h/g' -e 's/HASH/SHA512_256/g' \
-	                -e 's/SHA512_256_CTX/SHA2_CTX/g' helper.c > $@
+	                -e 's/SHA512_256_CTX/SHA2_CTX/g' "$(srcdir)/helper.c" > $@
 
 runtimelibdir = $(libdir)
 
-- 
2.39.3 (Apple Git-145)



More information about the libbsd mailing list