Makefile.am raw

   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/secp256k1_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_secp256k1_sha256_bitcoin_test.h
  67  noinst_HEADERS += src/hsort.h
  68  noinst_HEADERS += src/hsort_impl.h
  69  noinst_HEADERS += contrib/lax_der_parsing.h
  70  noinst_HEADERS += contrib/lax_der_parsing.c
  71  noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
  72  noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
  73  noinst_HEADERS += examples/examples_util.h
  74  
  75  PRECOMPUTED_LIB = libsecp256k1_precomputed.la
  76  noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
  77  libsecp256k1_precomputed_la_SOURCES =  src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
  78  # We need `-I$(top_srcdir)/src` in VPATH builds if libsecp256k1_precomputed_la_SOURCES have been recreated in the build tree.
  79  # This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
  80  libsecp256k1_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)
  81  
  82  if USE_EXTERNAL_ASM
  83  COMMON_LIB = libsecp256k1_common.la
  84  else
  85  COMMON_LIB =
  86  endif
  87  noinst_LTLIBRARIES += $(COMMON_LIB)
  88  
  89  pkgconfigdir = $(libdir)/pkgconfig
  90  pkgconfig_DATA = libsecp256k1.pc
  91  
  92  if USE_EXTERNAL_ASM
  93  if USE_ASM_ARM
  94  libsecp256k1_common_la_SOURCES = src/asm/field_10x26_arm.s
  95  endif
  96  endif
  97  
  98  libsecp256k1_la_SOURCES = src/secp256k1.c
  99  libsecp256k1_la_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 100  libsecp256k1_la_LIBADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
 101  libsecp256k1_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
 102  
 103  noinst_PROGRAMS =
 104  if USE_BENCHMARK
 105  noinst_PROGRAMS += bench bench_internal bench_ecmult
 106  bench_SOURCES = src/bench.c
 107  bench_LDADD = libsecp256k1.la
 108  bench_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 109  bench_internal_SOURCES = src/bench_internal.c
 110  bench_internal_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
 111  bench_internal_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 112  bench_ecmult_SOURCES = src/bench_ecmult.c
 113  bench_ecmult_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
 114  bench_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 115  endif
 116  
 117  TESTS =
 118  if USE_TESTS
 119  TESTS += noverify_tests
 120  noinst_PROGRAMS += noverify_tests
 121  noverify_tests_SOURCES = src/tests.c
 122  noverify_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 123  noverify_tests_LDADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
 124  noverify_tests_LDFLAGS = -static
 125  if !ENABLE_COVERAGE
 126  TESTS += tests
 127  noinst_PROGRAMS += tests
 128  tests_SOURCES  = $(noverify_tests_SOURCES)
 129  tests_CPPFLAGS = $(noverify_tests_CPPFLAGS) -DVERIFY
 130  tests_LDADD    = $(noverify_tests_LDADD)
 131  tests_LDFLAGS  = $(noverify_tests_LDFLAGS)
 132  endif
 133  endif
 134  
 135  if USE_CTIME_TESTS
 136  noinst_PROGRAMS += ctime_tests
 137  ctime_tests_SOURCES = src/ctime_tests.c
 138  ctime_tests_LDADD = libsecp256k1.la
 139  ctime_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 140  endif
 141  
 142  if USE_EXHAUSTIVE_TESTS
 143  noinst_PROGRAMS += exhaustive_tests
 144  exhaustive_tests_SOURCES = src/tests_exhaustive.c
 145  exhaustive_tests_CPPFLAGS = $(SECP_CONFIG_DEFINES)
 146  if !ENABLE_COVERAGE
 147  exhaustive_tests_CPPFLAGS += -DVERIFY
 148  endif
 149  # Note: do not include $(PRECOMPUTED_LIB) in exhaustive_tests (it uses runtime-generated tables).
 150  exhaustive_tests_LDADD = $(COMMON_LIB)
 151  exhaustive_tests_LDFLAGS = -static
 152  TESTS += exhaustive_tests
 153  endif
 154  
 155  if USE_EXAMPLES
 156  noinst_PROGRAMS += ecdsa_example
 157  ecdsa_example_SOURCES = examples/ecdsa.c
 158  ecdsa_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
 159  ecdsa_example_LDADD = libsecp256k1.la
 160  ecdsa_example_LDFLAGS = -static
 161  if BUILD_WINDOWS
 162  ecdsa_example_LDFLAGS += -lbcrypt
 163  endif
 164  TESTS += ecdsa_example
 165  if ENABLE_MODULE_ECDH
 166  noinst_PROGRAMS += ecdh_example
 167  ecdh_example_SOURCES = examples/ecdh.c
 168  ecdh_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
 169  ecdh_example_LDADD = libsecp256k1.la
 170  ecdh_example_LDFLAGS = -static
 171  if BUILD_WINDOWS
 172  ecdh_example_LDFLAGS += -lbcrypt
 173  endif
 174  TESTS += ecdh_example
 175  endif
 176  if ENABLE_MODULE_SCHNORRSIG
 177  noinst_PROGRAMS += schnorr_example
 178  schnorr_example_SOURCES = examples/schnorr.c
 179  schnorr_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
 180  schnorr_example_LDADD = libsecp256k1.la
 181  schnorr_example_LDFLAGS = -static
 182  if BUILD_WINDOWS
 183  schnorr_example_LDFLAGS += -lbcrypt
 184  endif
 185  TESTS += schnorr_example
 186  endif
 187  if ENABLE_MODULE_ELLSWIFT
 188  noinst_PROGRAMS += ellswift_example
 189  ellswift_example_SOURCES = examples/ellswift.c
 190  ellswift_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
 191  ellswift_example_LDADD = libsecp256k1.la
 192  ellswift_example_LDFLAGS = -static
 193  if BUILD_WINDOWS
 194  ellswift_example_LDFLAGS += -lbcrypt
 195  endif
 196  TESTS += ellswift_example
 197  endif
 198  if ENABLE_MODULE_MUSIG
 199  noinst_PROGRAMS += musig_example
 200  musig_example_SOURCES = examples/musig.c
 201  musig_example_CPPFLAGS = -I$(top_srcdir)/include -DSECP256K1_STATIC
 202  musig_example_LDADD = libsecp256k1.la
 203  musig_example_LDFLAGS = -static
 204  if BUILD_WINDOWS
 205  musig_example_LDFLAGS += -lbcrypt
 206  endif
 207  TESTS += musig_example
 208  endif
 209  endif
 210  
 211  ### Precomputed tables
 212  EXTRA_PROGRAMS = precompute_ecmult precompute_ecmult_gen
 213  CLEANFILES = $(EXTRA_PROGRAMS)
 214  
 215  precompute_ecmult_SOURCES = src/precompute_ecmult.c
 216  precompute_ecmult_CPPFLAGS = $(SECP_CONFIG_DEFINES) -DVERIFY
 217  precompute_ecmult_LDADD = $(COMMON_LIB)
 218  
 219  precompute_ecmult_gen_SOURCES = src/precompute_ecmult_gen.c
 220  precompute_ecmult_gen_CPPFLAGS = $(SECP_CONFIG_DEFINES) -DVERIFY
 221  precompute_ecmult_gen_LDADD = $(COMMON_LIB)
 222  
 223  # See Automake manual, Section "Errors with distclean".
 224  # We don't list any dependencies for the prebuilt files here because
 225  # otherwise make's decision whether to rebuild them (even in the first
 226  # build by a normal user) depends on mtimes, and thus is very fragile.
 227  # This means that rebuilds of the prebuilt files always need to be
 228  # forced by deleting them.
 229  src/precomputed_ecmult.c:
 230  	$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT)
 231  	./precompute_ecmult$(EXEEXT)
 232  src/precomputed_ecmult_gen.c:
 233  	$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(EXEEXT)
 234  	./precompute_ecmult_gen$(EXEEXT)
 235  
 236  PRECOMP = src/precomputed_ecmult_gen.c src/precomputed_ecmult.c
 237  precomp: $(PRECOMP)
 238  
 239  # Ensure the prebuilt files will be build first (only if they don't exist,
 240  # e.g., after `make maintainer-clean`).
 241  BUILT_SOURCES = $(PRECOMP)
 242  
 243  .PHONY: clean-precomp
 244  clean-precomp:
 245  	rm -f $(PRECOMP)
 246  maintainer-clean-local: clean-precomp
 247  
 248  ### Pregenerated test vectors
 249  ### (see the comments in the previous section for detailed rationale)
 250  TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
 251  
 252  src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
 253  	mkdir -p $(@D)
 254  	python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
 255  
 256  testvectors: $(TESTVECTORS)
 257  
 258  BUILT_SOURCES += $(TESTVECTORS)
 259  
 260  .PHONY: clean-testvectors
 261  clean-testvectors:
 262  	rm -f $(TESTVECTORS)
 263  maintainer-clean-local: clean-testvectors
 264  
 265  ### Additional files to distribute
 266  EXTRA_DIST = autogen.sh CHANGELOG.md SECURITY.md
 267  EXTRA_DIST += doc/release-process.md doc/safegcd_implementation.md
 268  EXTRA_DIST += doc/ellswift.md doc/musig.md
 269  EXTRA_DIST += examples/EXAMPLES_COPYING
 270  EXTRA_DIST += sage/gen_exhaustive_groups.sage
 271  EXTRA_DIST += sage/gen_split_lambda_constants.sage
 272  EXTRA_DIST += sage/group_prover.sage
 273  EXTRA_DIST += sage/prove_group_implementations.sage
 274  EXTRA_DIST += sage/secp256k1_params.sage
 275  EXTRA_DIST += sage/weierstrass_prover.sage
 276  EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
 277  EXTRA_DIST += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json
 278  EXTRA_DIST += tools/tests_wycheproof_generate.py
 279  
 280  if ENABLE_MODULE_ECDH
 281  include src/modules/ecdh/Makefile.am.include
 282  endif
 283  
 284  if ENABLE_MODULE_RECOVERY
 285  include src/modules/recovery/Makefile.am.include
 286  endif
 287  
 288  if ENABLE_MODULE_EXTRAKEYS
 289  include src/modules/extrakeys/Makefile.am.include
 290  endif
 291  
 292  if ENABLE_MODULE_SCHNORRSIG
 293  include src/modules/schnorrsig/Makefile.am.include
 294  endif
 295  
 296  if ENABLE_MODULE_MUSIG
 297  include src/modules/musig/Makefile.am.include
 298  endif
 299  
 300  if ENABLE_MODULE_ELLSWIFT
 301  include src/modules/ellswift/Makefile.am.include
 302  endif
 303