Skip to content

Commit

Permalink
improve makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
chcmedeiros committed Feb 10, 2025
1 parent 9c56339 commit f62d92e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
51 changes: 26 additions & 25 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ endif

MY_DIR := $(dir $(lastword $(MAKEFILE_LIST)))

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.installer_script

include $(BOLOS_SDK)/Makefile.defines

# Set the default value for PRODUCTION_BUILD to 1 if not already defined
PRODUCTION_BUILD ?= 1

$(info ************ TARGET_NAME = [$(TARGET_NAME)])
# Display whether this is a production build or for internal use
ifeq ($(PRODUCTION_BUILD), 1)
$(info ************ PRODUCTION_BUILD = [PRODUCTION BUILD])
Expand All @@ -39,19 +34,22 @@ endif

# Add the PRODUCTION_BUILD definition to the compiler flags
DEFINES += PRODUCTION_BUILD=$(PRODUCTION_BUILD)

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.app_testing

ifndef COIN
COIN=NAM
endif

VARIANT_PARAM=COIN
VARIANT_VALUES=$(COIN)

include $(CURDIR)/Makefile.version

$(info COIN = [$(COIN)])

ifeq ($(COIN),NAM)
# Main app configuration
DEFINES += APP_STANDARD
APPNAME = "Namada"
APPPATH = "44'/877'" --path "44'/1'"

Expand All @@ -66,33 +64,44 @@ endif

APP_LOAD_PARAMS = --curve ed25519 $(COMMON_LOAD_PARAMS) --path $(APPPATH)

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices
# Enable QR code display for all devices
ENABLE_NBGL_QRCODE ?= 1

$(info TARGET_NAME = [$(TARGET_NAME)])
$(info ICONNAME = [$(ICONNAME)])
RUST_TARGET:=thumbv6m-none-eabi

ifndef ICONNAME
$(error ICONNAME is not set)
endif
$(info ************ RUST_TARGET = [$(RUST_TARGET)])

include $(BOLOS_SDK)/Makefile.target

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform

# Compile MASP mode for all devices excetpt Nano S,
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += COMPILE_MASP
endif

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform
# Add SDK BLAKE2b
DEFINES += HAVE_HASH HAVE_BLAKE2
INCLUDES_PATH += $(BOLOS_SDK)/lib_cxng/src


# Building Rust
LDFLAGS += -z muldefs
LDLIBS += -L$(MY_DIR)rust/target/$(RUST_TARGET)/release -lrslib

APP_SOURCE_PATH += $(CURDIR)/rust/include
APP_CUSTOM_LINK_DEPENDENCIES = rust
RUST_TARGET:=thumbv6m-none-eabi

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.installer_script

$(info TARGET_NAME = [$(TARGET_NAME)])
$(info ICONNAME = [$(ICONNAME)])

ifndef ICONNAME
$(error ICONNAME is not set)
endif

# make rust a prerequisite for all object files
$(OBJECT_FILES): | rust

.PHONY: rust
rust:
Expand All @@ -104,17 +113,9 @@ rust_clean:

clean: rust_clean

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.side_loading

# Import generic rules from the SDK
include $(BOLOS_SDK)/Makefile.rules

#add dependency on custom makefile filename
dep/%.d: %.c Makefile

listvariants:
@echo VARIANTS COIN NAM

.PHONY: version
version:
@echo "v$(APPVERSION)" > app.version
12 changes: 6 additions & 6 deletions app/src/apdu_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ __Z_INLINE void handle_getversion(__Z_UNUSED volatile uint32_t *flags, volatile
G_io_apdu_buffer[0] = 0x01;
#endif

G_io_apdu_buffer[1] = (LEDGER_MAJOR_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[2] = (LEDGER_MAJOR_VERSION >> 0) & 0xFF;
G_io_apdu_buffer[1] = (MAJOR_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[2] = (MAJOR_VERSION >> 0) & 0xFF;

G_io_apdu_buffer[3] = (LEDGER_MINOR_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[4] = (LEDGER_MINOR_VERSION >> 0) & 0xFF;
G_io_apdu_buffer[3] = (MINOR_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[4] = (MINOR_VERSION >> 0) & 0xFF;

G_io_apdu_buffer[5] = (LEDGER_PATCH_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[6] = (LEDGER_PATCH_VERSION >> 0) & 0xFF;
G_io_apdu_buffer[5] = (PATCH_VERSION >> 8) & 0xFF;
G_io_apdu_buffer[6] = (PATCH_VERSION >> 0) & 0xFF;

// SDK won't reply if device is blocked ---> Always false
G_io_apdu_buffer[7] = 0;
Expand Down
4 changes: 2 additions & 2 deletions app/src/common/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#include "tx.h"
#include "apdu_codes.h"
#include "buffering.h"
#include "parser.h"
#include "common/parser.h"
#include <string.h>
#include "zxmacros.h"

#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_STAX) || defined(TARGET_FLEX)
#define RAM_BUFFER_SIZE 8192
#define FLASH_BUFFER_SIZE 16384
#elif defined(TARGET_NANOS)
#define RAM_BUFFER_SIZE 256
#define RAM_BUFFER_SIZE 0
#define FLASH_BUFFER_SIZE 8192
#endif

Expand Down
2 changes: 1 addition & 1 deletion app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "parser_common.h"
#include "parser_impl.h"
#include "parser.h"
#include "common/parser.h"

#include "crypto.h"
#include "crypto_helper.h"
Expand Down
2 changes: 1 addition & 1 deletion fuzz/parser_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <cstdint>
#include <cstdio>

#include "parser.h"
#include "common/parser.h"
#include "zxformat.h"

#ifdef NDEBUG
Expand Down
3 changes: 1 addition & 2 deletions tests/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "gmock/gmock.h"
#include "parser_impl.h"

#include <parser.h>
#include <common/parser.h>
#include <sstream>
#include <string>
#include <fmt/core.h>
Expand All @@ -26,7 +26,6 @@
#include <json/json.h>
#include <app_mode.h>
#include <hexutils.h>
#include "parser.h"

std::vector<std::string> dumpUI(parser_context_t *ctx,
uint16_t maxKeyLen,
Expand Down

0 comments on commit f62d92e

Please sign in to comment.