Add automatic dependency building to Makefile

- Add secp256k1 auto-building rule for x64 target
- Fix customer build errors with missing secp256k1/.libs/libsecp256k1.a
- Force clean rebuild when secp256k1 library is missing
- Customers can now run 'make' directly without manual dependency building
- Maintains existing ARM64 cross-compilation auto-building functionality
This commit is contained in:
Laan Tungir 2025-08-14 17:43:33 -04:00
parent 993ca0f2a1
commit f1c22bdf53
1 changed files with 15 additions and 0 deletions

View File

@ -43,6 +43,21 @@ default: $(STATIC_LIB) $(ARM64_STATIC_LIB)
# Build all targets (static only)
all: $(STATIC_LIB) $(ARM64_STATIC_LIB) examples
# Build secp256k1 for x86_64
$(SECP256K1_LIB): secp256k1/configure
@echo "Building secp256k1 for x86_64..."
@cd secp256k1 && \
if [ ! -f .libs/libsecp256k1.a ]; then \
echo "Cleaning and configuring secp256k1..."; \
make distclean >/dev/null 2>&1 || true; \
./configure --enable-module-schnorrsig --enable-module-ecdh --enable-experimental --disable-shared --enable-static --with-pic; \
echo "Building secp256k1 library..."; \
make -j$(shell nproc 2>/dev/null || echo 4); \
else \
echo "secp256k1 library already exists, skipping build"; \
fi
@echo "x86_64 secp256k1 library built successfully"
# Static library - includes secp256k1 and OpenSSL objects for self-contained library
$(STATIC_LIB): $(LIB_OBJECTS) $(SECP256K1_LIB)
@echo "Creating self-contained static library: $@"