Follow-up to #1245.
This builds on top of #1276. Let’s only merge #1276 as a hotfix for the Core build.
232+
233+src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
234+ mkdir -p $(@D)
235+ python3 tools/tests_wycheproof_generate.py src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
236+
237+testvectors: $(TESTVECTORS)
0.PHONY: testvectors
1testvectors: $(TESTVECTORS)
In 3955f8f9940f35a37faa01c08d17795adf8ceb43
autotools: Rename “pregenerated” clean targets and make them .PHONY
This follows the automake conventions, see: https://www.gnu.org/software/automake/manual/html_node/Clean.html
The clean-precomp
was .PHONY
: https://github.com/bitcoin-core/secp256k1/blob/3bab71cf0534fd5948386de2b6ac31a7044ad76b/Makefile.am#L1
A comment needs to be updated: https://github.com/bitcoin-core/secp256k1/blob/3bab71cf0534fd5948386de2b6ac31a7044ad76b/Makefile.am#L205
Why not just MAINTAINERCLEANFILES = $(PRECOMP) $(TESTVECTORS)
?
0--- a/ci/cirrus.sh
1+++ b/ci/cirrus.sh
2@@ -109,7 +109,7 @@ fi
3 # Rebuild precomputed files (if not cross-compiling).
4 if [ -z "$HOST" ]
5 then
6- make clean-precomp clean-testvectors
7+ make maintainer-clean
8 make precomp testvectors
9 fi
10
to fix CI?
Why not just
MAINTAINERCLEANFILES = $(PRECOMP) $(TESTVECTORS)
?
Yeah, that would work, too. But I think it’s nice to have the ability to clean precomp
or testvectors
separately. I’ll address the other comments.
(Apparently it was a good idea that I opened a separate PR for the first commit.)
I changed my mind and removed the renaming. It’s not clear that a “maintainer”-prefix is better… Sorry for the back and forth.
Independently, make maintainer-clean
in the Cirrus script won’t work because that target also removes the Makefile.
226+### Pregenerated test vectors
227+### (see the comments in the previous section for detailed rationale)
228+TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
229+
230+src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
231+ mkdir -p $(@D)
For more robustness, could consider
0 $(MKDIR_P) $(@D)
with the AC_PROG_MKDIR_P
macro in the configure.ac
?
As I understand the history of this, the reason why this macro exists is that some implementations of mkdir -p
on some old systems are not thread safe. And that’s a problem in a parallel make, where multiple make processes try to create the same directory (see https://lists.gnu.org/r/automake/2006-04/msg00084.html).
I don’t see how this could be a problem here, given that there’s only a single recipe in the Makefile that creates this directory. That’s why I think it’s better to stick to mkdir -p
here for simplicity.
227+### (see the comments in the previous section for detailed rationale)
228+TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
229+
230+src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
231+ mkdir -p $(@D)
232+ python3 tools/tests_wycheproof_generate.py src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
2dd672a287a0c9c4382ffbf56f690727f2e74696
To make it work in a VPATH build, the diff required as follows:
0 python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
200@@ -202,7 +201,7 @@ precompute_ecmult_gen_LDADD = $(COMMON_LIB)
201 # otherwise make's decision whether to rebuild them (even in the first
202 # build by a normal user) depends on mtimes, and thus is very fragile.
203 # This means that rebuilds of the prebuilt files always need to be
204-# forced by deleting them, e.g., by invoking `make clean-precomp`.
205+# forced by deleting them, e.g., using `make maintainer-clean`.
This follows the automake conventions more, see:
https://www.gnu.org/software/automake/manual/html_node/Clean.html
This directory may not exist in a VPATH build,
see https://github.com/bitcoin/bitcoin/pull/27445#issuecomment-1502994264 .