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)
.PHONY: testvectors
testvectors: $(TESTVECTORS)
nm, ignore this ^
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)?
--- a/ci/cirrus.sh
+++ b/ci/cirrus.sh
@@ -109,7 +109,7 @@ fi
# Rebuild precomputed files (if not cross-compiling).
if [ -z "$HOST" ]
then
- make clean-precomp clean-testvectors
+ make maintainer-clean
make precomp testvectors
fi
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
$(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:
python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
added a commit
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`.
I just removed that part.
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 .
ACK 7e977b3c5071fc17575ff88ebbc9db7b17c70497