|
| 1 | +.PHONY: clean-precomp precomp |
| 2 | + |
1 | 3 | ACLOCAL_AMFLAGS = -I build-aux/m4
|
2 | 4 |
|
3 | 5 | # AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
|
@@ -52,6 +54,7 @@ noinst_HEADERS += src/hash_impl.h
|
52 | 54 | noinst_HEADERS += src/field.h
|
53 | 55 | noinst_HEADERS += src/field_impl.h
|
54 | 56 | noinst_HEADERS += src/bench.h
|
| 57 | +noinst_HEADERS += src/basic-config.h |
55 | 58 | noinst_HEADERS += contrib/lax_der_parsing.h
|
56 | 59 | noinst_HEADERS += contrib/lax_der_parsing.c
|
57 | 60 | noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
|
@@ -125,37 +128,39 @@ exhaustive_tests_LDFLAGS = -static
|
125 | 128 | TESTS += exhaustive_tests
|
126 | 129 | endif
|
127 | 130 |
|
128 |
| -EXTRA_PROGRAMS = gen_ecmult_static_pre_g |
| 131 | +### Precomputed tables |
| 132 | +EXTRA_PROGRAMS = gen_ecmult_static_pre_g gen_ecmult_gen_static_prec_table |
| 133 | +CLEANFILES = $(EXTRA_PROGRAMS) |
129 | 134 | gen_ecmult_static_pre_g_SOURCES = src/gen_ecmult_static_pre_g.c
|
130 |
| -# See Automake manual, Section "Errors with distclean" |
| 135 | +gen_ecmult_gen_static_prec_table_SOURCES = src/gen_ecmult_gen_static_prec_table.c |
| 136 | + |
| 137 | +# See Automake manual, Section "Errors with distclean". |
| 138 | +# We don't list any dependencies for the prebuilt files here because |
| 139 | +# otherwise make's decision whether to rebuild them (even in the first |
| 140 | +# build by a normal user) depends on mtimes, and thus is very fragile. |
| 141 | +# This means that rebuilds of the prebuilt files always need to be |
| 142 | +# forced by deleting them, e.g., by invoking `make clean-precomp`. |
131 | 143 | src/ecmult_static_pre_g.h:
|
132 | 144 | $(MAKE) $(AM_MAKEFLAGS) gen_ecmult_static_pre_g$(EXEEXT)
|
133 | 145 | ./gen_ecmult_static_pre_g$(EXEEXT)
|
| 146 | +src/ecmult_gen_static_prec_table.h: |
| 147 | + $(MAKE) $(AM_MAKEFLAGS) gen_ecmult_gen_static_prec_table$(EXEEXT) |
| 148 | + ./gen_ecmult_gen_static_prec_table$(EXEEXT) |
134 | 149 |
|
135 |
| -if USE_ECMULT_STATIC_PRECOMPUTATION |
136 |
| -CPPFLAGS_FOR_BUILD +=-I$(top_srcdir) -I$(builddir)/src |
137 |
| - |
138 |
| -gen_ecmult_gen_static_prec_table_OBJECTS = gen_ecmult_gen_static_prec_table.o |
139 |
| -gen_ecmult_gen_static_prec_table_BIN = gen_ecmult_gen_static_prec_table$(BUILD_EXEEXT) |
140 |
| -$(gen_ecmult_gen_static_prec_table_OBJECTS): src/gen_ecmult_gen_static_prec_table.c src/libsecp256k1-config.h |
141 |
| - $(CC_FOR_BUILD) $(DEFS) $(CPPFLAGS_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@ |
| 150 | +PRECOMP = src/ecmult_gen_static_prec_table.h src/ecmult_static_pre_g.h |
| 151 | +noinst_HEADERS += $(PRECOMP) |
| 152 | +precomp: $(PRECOMP) |
142 | 153 |
|
143 |
| -$(gen_ecmult_gen_static_prec_table_BIN): $(gen_ecmult_gen_static_prec_table_OBJECTS) |
144 |
| - $(CC_FOR_BUILD) $(SECP_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@ |
| 154 | +# Ensure the prebuilt files will be build first (only if they don't exist, |
| 155 | +# e.g., after `make maintainer-clean`). |
| 156 | +BUILT_SOURCES = $(PRECOMP) |
145 | 157 |
|
146 |
| -$(libsecp256k1_la_OBJECTS): src/ecmult_gen_static_prec_table.h |
147 |
| -$(tests_OBJECTS): src/ecmult_gen_static_prec_table.h |
148 |
| -$(exhaustive_tests_OBJECTS): src/ecmult_gen_static_prec_table.h |
149 |
| -$(bench_internal_OBJECTS): src/ecmult_gen_static_prec_table.h |
150 |
| -$(bench_ecmult_OBJECTS): src/ecmult_gen_static_prec_table.h |
| 158 | +maintainer-clean-local: clean-precomp |
151 | 159 |
|
152 |
| -src/ecmult_gen_static_prec_table.h: $(gen_ecmult_gen_static_prec_table_BIN) |
153 |
| - ./$(gen_ecmult_gen_static_prec_table_BIN) |
154 |
| - |
155 |
| -CLEANFILES = $(gen_ecmult_gen_static_prec_table_BIN) src/ecmult_gen_static_prec_table.h |
156 |
| -endif |
| 160 | +clean-precomp: |
| 161 | + rm -f $(PRECOMP) |
157 | 162 |
|
158 |
| -EXTRA_DIST = autogen.sh src/gen_ecmult_gen_static_prec_table.c src/ecmult_static_pre_g.h src/basic-config.h |
| 163 | +EXTRA_DIST = autogen.sh SECURITY.md |
159 | 164 |
|
160 | 165 | if ENABLE_MODULE_ECDH
|
161 | 166 | include src/modules/ecdh/Makefile.am.include
|
|
0 commit comments