csecp256k1

Haskell FFI bindings to bitcoin-core/secp256k1 (docs.ppad.tech/csecp256k1).
git clone git://git.ppad.tech/csecp256k1.git
Log | Files | Refs | README | LICENSE

Makefile.am (9484B)


      1 ACLOCAL_AMFLAGS = -I build-aux/m4
      2 
      3 # AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
      4 # which does not have an explicit foo_CFLAGS variable set.
      5 AM_CFLAGS = $(SECP_CFLAGS)
      6 
      7 lib_LTLIBRARIES = libsecp256k1.la
      8 include_HEADERS = include/secp256k1.h
      9 include_HEADERS += include/haskellsecp256k1_v0_1_0_preallocated.h
     10 noinst_HEADERS =
     11 noinst_HEADERS += src/scalar.h
     12 noinst_HEADERS += src/scalar_4x64.h
     13 noinst_HEADERS += src/scalar_8x32.h
     14 noinst_HEADERS += src/scalar_low.h
     15 noinst_HEADERS += src/scalar_impl.h
     16 noinst_HEADERS += src/scalar_4x64_impl.h
     17 noinst_HEADERS += src/scalar_8x32_impl.h
     18 noinst_HEADERS += src/scalar_low_impl.h
     19 noinst_HEADERS += src/group.h
     20 noinst_HEADERS += src/group_impl.h
     21 noinst_HEADERS += src/ecdsa.h
     22 noinst_HEADERS += src/ecdsa_impl.h
     23 noinst_HEADERS += src/eckey.h
     24 noinst_HEADERS += src/eckey_impl.h
     25 noinst_HEADERS += src/ecmult.h
     26 noinst_HEADERS += src/ecmult_impl.h
     27 noinst_HEADERS += src/ecmult_compute_table.h
     28 noinst_HEADERS += src/ecmult_compute_table_impl.h
     29 noinst_HEADERS += src/ecmult_const.h
     30 noinst_HEADERS += src/ecmult_const_impl.h
     31 noinst_HEADERS += src/ecmult_gen.h
     32 noinst_HEADERS += src/ecmult_gen_impl.h
     33 noinst_HEADERS += src/ecmult_gen_compute_table.h
     34 noinst_HEADERS += src/ecmult_gen_compute_table_impl.h
     35 noinst_HEADERS += src/field_10x26.h
     36 noinst_HEADERS += src/field_10x26_impl.h
     37 noinst_HEADERS += src/field_5x52.h
     38 noinst_HEADERS += src/field_5x52_impl.h
     39 noinst_HEADERS += src/field_5x52_int128_impl.h
     40 noinst_HEADERS += src/modinv32.h
     41 noinst_HEADERS += src/modinv32_impl.h
     42 noinst_HEADERS += src/modinv64.h
     43 noinst_HEADERS += src/modinv64_impl.h
     44 noinst_HEADERS += src/precomputed_ecmult.h
     45 noinst_HEADERS += src/precomputed_ecmult_gen.h
     46 noinst_HEADERS += src/assumptions.h
     47 noinst_HEADERS += src/checkmem.h
     48 noinst_HEADERS += src/testutil.h
     49 noinst_HEADERS += src/util.h
     50 noinst_HEADERS += src/int128.h
     51 noinst_HEADERS += src/int128_impl.h
     52 noinst_HEADERS += src/int128_native.h
     53 noinst_HEADERS += src/int128_native_impl.h
     54 noinst_HEADERS += src/int128_struct.h
     55 noinst_HEADERS += src/int128_struct_impl.h
     56 noinst_HEADERS += src/scratch.h
     57 noinst_HEADERS += src/scratch_impl.h
     58 noinst_HEADERS += src/selftest.h
     59 noinst_HEADERS += src/testrand.h
     60 noinst_HEADERS += src/testrand_impl.h
     61 noinst_HEADERS += src/hash.h
     62 noinst_HEADERS += src/hash_impl.h
     63 noinst_HEADERS += src/field.h
     64 noinst_HEADERS += src/field_impl.h
     65 noinst_HEADERS += src/bench.h
     66 noinst_HEADERS += src/wycheproof/ecdsa_haskellsecp256k1_v0_1_0_sha256_bitcoin_test.h
     67 noinst_HEADERS += contrib/lax_der_parsing.h
     68 noinst_HEADERS += contrib/lax_der_parsing.c
     69 noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
     70 noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
     71 noinst_HEADERS += examples/examples_util.h
     72 
     73 PRECOMPUTED_LIB = libhaskellsecp256k1_v0_1_0_precomputed.la
     74 noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
     75 libhaskellsecp256k1_v0_1_0_precomputed_la_SOURCES =  src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
     76 # We need `-I$(top_srcdir)/src` in VPATH builds if libhaskellsecp256k1_v0_1_0_precomputed_la_SOURCES have been recreated in the build tree.
     77 # This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
     78 libhaskellsecp256k1_v0_1_0_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)
     79 
     80 if USE_EXTERNAL_ASM
     81 COMMON_LIB = libhaskellsecp256k1_v0_1_0_common.la
     82 else
     83 COMMON_LIB =
     84 endif
     85 noinst_LTLIBRARIES += $(COMMON_LIB)
     86 
     87 pkgconfigdir = $(libdir)/pkgconfig
     88 pkgconfig_DATA = libsecp256k1.pc
     89 
     90 if USE_EXTERNAL_ASM
     91 if USE_ASM_ARM
     92 libhaskellsecp256k1_v0_1_0_common_la_SOURCES = src/asm/field_10x26_arm.s
     93 endif
     94 endif
     95 
     96 libhaskellsecp256k1_v0_1_0_la_SOURCES = src/secp256k1.c
     97 libhaskellsecp256k1_v0_1_0_la_CPPFLAGS = $(SECP_CONFIG_DEFINES)
     98 libhaskellsecp256k1_v0_1_0_la_LIBADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
     99 libhaskellsecp256k1_v0_1_0_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
    100 
    101 noinst_PROGRAMS =
    102 if USE_BENCHMARK
    103 noinst_PROGRAMS += bench bench_internal bench_ecmult
    104 bench_SOURCES = src/bench.c
    105 bench_LDADD = libsecp256k1.la
    106 bench_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    107 bench_internal_SOURCES = src/bench_internal.c
    108 bench_internal_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
    109 bench_internal_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    110 bench_ecmult_SOURCES = src/bench_ecmult.c
    111 bench_ecmult_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
    112 bench_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    113 endif
    114 
    115 TESTS =
    116 if USE_TESTS
    117 TESTS += noverify_tests
    118 noinst_PROGRAMS += noverify_tests
    119 noverify_tests_SOURCES = src/tests.c
    120 noverify_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    121 noverify_tests_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
    122 noverify_tests_LDFLAGS = -static
    123 if !ENABLE_COVERAGE
    124 TESTS += tests
    125 noinst_PROGRAMS += tests
    126 tests_SOURCES  = $(noverify_tests_SOURCES)
    127 tests_CPPFLAGS = $(noverify_tests_CPPFLAGS) -DVERIFY
    128 tests_LDADD    = $(noverify_tests_LDADD)
    129 tests_LDFLAGS  = $(noverify_tests_LDFLAGS)
    130 endif
    131 endif
    132 
    133 if USE_CTIME_TESTS
    134 noinst_PROGRAMS += ctime_tests
    135 ctime_tests_SOURCES = src/ctime_tests.c
    136 ctime_tests_LDADD = libsecp256k1.la
    137 ctime_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    138 endif
    139 
    140 if USE_EXHAUSTIVE_TESTS
    141 noinst_PROGRAMS += exhaustive_tests
    142 exhaustive_tests_SOURCES = src/tests_exhaustive.c
    143 exhaustive_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
    144 if !ENABLE_COVERAGE
    145 exhaustive_tests_CPPFLAGS += -DVERIFY
    146 endif
    147 # Note: do not include $(PRECOMPUTED_LIB) in exhaustive_tests (it uses runtime-generated tables).
    148 exhaustive_tests_LDADD = $(COMMON_LIB)
    149 exhaustive_tests_LDFLAGS = -static
    150 TESTS += exhaustive_tests
    151 endif
    152 
    153 if USE_EXAMPLES
    154 noinst_PROGRAMS += ecdsa_example
    155 ecdsa_example_SOURCES = examples/ecdsa.c
    156 ecdsa_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
    157 ecdsa_example_LDADD = libsecp256k1.la
    158 ecdsa_example_LDFLAGS = -static
    159 if BUILD_WINDOWS
    160 ecdsa_example_LDFLAGS += -lbcrypt
    161 endif
    162 TESTS += ecdsa_example
    163 if ENABLE_MODULE_ECDH
    164 noinst_PROGRAMS += ecdh_example
    165 ecdh_example_SOURCES = examples/ecdh.c
    166 ecdh_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
    167 ecdh_example_LDADD = libsecp256k1.la
    168 ecdh_example_LDFLAGS = -static
    169 if BUILD_WINDOWS
    170 ecdh_example_LDFLAGS += -lbcrypt
    171 endif
    172 TESTS += ecdh_example
    173 endif
    174 if ENABLE_MODULE_SCHNORRSIG
    175 noinst_PROGRAMS += schnorr_example
    176 schnorr_example_SOURCES = examples/schnorr.c
    177 schnorr_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
    178 schnorr_example_LDADD = libsecp256k1.la
    179 schnorr_example_LDFLAGS = -static
    180 if BUILD_WINDOWS
    181 schnorr_example_LDFLAGS += -lbcrypt
    182 endif
    183 TESTS += schnorr_example
    184 endif
    185 endif
    186 
    187 ### Precomputed tables
    188 EXTRA_PROGRAMS = precompute_ecmult precompute_ecmult_gen
    189 CLEANFILES = $(EXTRA_PROGRAMS)
    190 
    191 precompute_ecmult_SOURCES = src/precompute_ecmult.c
    192 precompute_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES) -DVERIFY
    193 precompute_ecmult_LDADD = $(COMMON_LIB)
    194 
    195 precompute_ecmult_gen_SOURCES = src/precompute_ecmult_gen.c
    196 precompute_ecmult_gen_CPPFLAGS = $(SECP_CONFIG_DEFINES) -DVERIFY
    197 precompute_ecmult_gen_LDADD = $(COMMON_LIB)
    198 
    199 # See Automake manual, Section "Errors with distclean".
    200 # We don't list any dependencies for the prebuilt files here because
    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.
    205 src/precomputed_ecmult.c:
    206 	$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT)
    207 	./precompute_ecmult$(EXEEXT)
    208 src/precomputed_ecmult_gen.c:
    209 	$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(EXEEXT)
    210 	./precompute_ecmult_gen$(EXEEXT)
    211 
    212 PRECOMP = src/precomputed_ecmult_gen.c src/precomputed_ecmult.c
    213 precomp: $(PRECOMP)
    214 
    215 # Ensure the prebuilt files will be build first (only if they don't exist,
    216 # e.g., after `make maintainer-clean`).
    217 BUILT_SOURCES = $(PRECOMP)
    218 
    219 .PHONY: clean-precomp
    220 clean-precomp:
    221 	rm -f $(PRECOMP)
    222 maintainer-clean-local: clean-precomp
    223 
    224 ### Pregenerated test vectors
    225 ### (see the comments in the previous section for detailed rationale)
    226 TESTVECTORS = src/wycheproof/ecdsa_haskellsecp256k1_v0_1_0_sha256_bitcoin_test.h
    227 
    228 src/wycheproof/ecdsa_haskellsecp256k1_v0_1_0_sha256_bitcoin_test.h:
    229 	mkdir -p $(@D)
    230 	python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_haskellsecp256k1_v0_1_0_sha256_bitcoin_test.json > $@
    231 
    232 testvectors: $(TESTVECTORS)
    233 
    234 BUILT_SOURCES += $(TESTVECTORS)
    235 
    236 .PHONY: clean-testvectors
    237 clean-testvectors:
    238 	rm -f $(TESTVECTORS)
    239 maintainer-clean-local: clean-testvectors
    240 
    241 ### Additional files to distribute
    242 EXTRA_DIST = autogen.sh CHANGELOG.md SECURITY.md
    243 EXTRA_DIST += doc/release-process.md doc/safegcd_implementation.md
    244 EXTRA_DIST += examples/EXAMPLES_COPYING
    245 EXTRA_DIST += sage/gen_exhaustive_groups.sage
    246 EXTRA_DIST += sage/gen_split_lambda_constants.sage
    247 EXTRA_DIST += sage/group_prover.sage
    248 EXTRA_DIST += sage/prove_group_implementations.sage
    249 EXTRA_DIST += sage/haskellsecp256k1_v0_1_0_params.sage
    250 EXTRA_DIST += sage/weierstrass_prover.sage
    251 EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
    252 EXTRA_DIST += src/wycheproof/ecdsa_haskellsecp256k1_v0_1_0_sha256_bitcoin_test.json
    253 EXTRA_DIST += tools/tests_wycheproof_generate.py
    254 
    255 if ENABLE_MODULE_ECDH
    256 include src/modules/ecdh/Makefile.am.include
    257 endif
    258 
    259 if ENABLE_MODULE_RECOVERY
    260 include src/modules/recovery/Makefile.am.include
    261 endif
    262 
    263 if ENABLE_MODULE_EXTRAKEYS
    264 include src/modules/extrakeys/Makefile.am.include
    265 endif
    266 
    267 if ENABLE_MODULE_SCHNORRSIG
    268 include src/modules/schnorrsig/Makefile.am.include
    269 endif
    270 
    271 if ENABLE_MODULE_ELLSWIFT
    272 include src/modules/ellswift/Makefile.am.include
    273 endif