1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

build: makefile cleanup - part 1

This commit is contained in:
Pavol Rusnak 2017-04-19 22:40:15 +02:00
parent f7484fefde
commit ae6be43ba0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 72 additions and 56 deletions

View File

@ -55,10 +55,13 @@ OBJ_HAL += $(addprefix $(BUILD_MP)/,\
) )
# OBJ micropython/ # OBJ micropython/
OBJ_FW += $(addprefix $(BUILD_FW)/, \ OBJ_BOARDLOADER += $(addprefix $(BUILD_FW)/, \
boardloader/main.o \ boardloader/main.o \
extmod/modtrezorui/display.o \ extmod/modtrezorui/display.o \
extmod/modtrezorui/font_bitmap.o \ extmod/modtrezorui/font_bitmap.o \
)
OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \
trezorhal/common.o \ trezorhal/common.o \
trezorhal/image.o \ trezorhal/image.o \
trezorhal/flash.o \ trezorhal/flash.o \
@ -84,10 +87,8 @@ OBJ_MOD += \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \ $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \
OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_FW) OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL)
SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MP)) OBJ += $(OBJ_BOARDLOADER)
SRC_FW = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_FW))
SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD))
# comp flags # comp flags
# ===================================== # =====================================

View File

@ -18,8 +18,8 @@ BUILD_HDR = $(BUILD)/genhdr
# OBJ vendor/micropython # OBJ vendor/micropython
OBJ_MP += $(addprefix $(BUILD_MP)/,\ OBJ_MP += $(addprefix $(BUILD_MP)/,\
lib/libc/string0.o \
stmhal/startup_stm32.o \ stmhal/startup_stm32.o \
lib/libc/string0.o \
) )
# OBJ vendor/micropython # OBJ vendor/micropython
@ -55,7 +55,7 @@ OBJ_HAL += $(addprefix $(BUILD_MP)/,\
) )
# OBJ micropython/ # OBJ micropython/
OBJ_FW += $(addprefix $(BUILD_FW)/, \ OBJ_BOOTLOADER += $(addprefix $(BUILD_FW)/, \
bootloader/header.o \ bootloader/header.o \
bootloader/main.o \ bootloader/main.o \
bootloader/messages.o \ bootloader/messages.o \
@ -66,6 +66,9 @@ OBJ_FW += $(addprefix $(BUILD_FW)/, \
extmod/modtrezorui/font_roboto_bold_20.o \ extmod/modtrezorui/font_roboto_bold_20.o \
extmod/modtrezorui/font_roboto_regular_20.o \ extmod/modtrezorui/font_roboto_regular_20.o \
extmod/modtrezorui/font_robotomono_regular_20.o \ extmod/modtrezorui/font_robotomono_regular_20.o \
)
OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \
trezorhal/common.o \ trezorhal/common.o \
trezorhal/image.o \ trezorhal/image.o \
trezorhal/flash.o \ trezorhal/flash.o \
@ -96,10 +99,8 @@ OBJ_MOD += \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \ $(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \
OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_FW) OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL)
SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MP)) OBJ += $(OBJ_BOOTLOADER)
SRC_FW = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_FW))
SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD))
# comp flags # comp flags
# ===================================== # =====================================

View File

@ -33,9 +33,10 @@ MICROPY_PY_UTIME = 1
# OBJ micropython/extmod/modtrezorconfig # OBJ micropython/extmod/modtrezorconfig
ifeq ($(MICROPY_PY_TREZORCONFIG),1) ifeq ($(MICROPY_PY_TREZORCONFIG),1)
OBJ_MOD += \ OBJ_MOD += $(addprefix $(BUILD_FW)/,\
$(BUILD_FW)/extmod/modtrezorconfig/modtrezorconfig.o \ extmod/modtrezorconfig/modtrezorconfig.o \
$(BUILD_FW)/extmod/modtrezorconfig/norcow.o extmod/modtrezorconfig/norcow.o \
)
endif endif
# OBJ micropython/extmod/modtrezorcrypto # OBJ micropython/extmod/modtrezorcrypto
@ -47,66 +48,75 @@ CFLAGS_MOD += \
-DAES_192 \ -DAES_192 \
-DUSE_KECCAK=1 \ -DUSE_KECCAK=1 \
-Wno-sequence-point -Wno-sequence-point
OBJ_MOD += \ OBJ_MOD += $(addprefix $(BUILD_FW)/,\
$(BUILD_FW)/extmod/modtrezorcrypto/modtrezorcrypto.o \ extmod/modtrezorcrypto/modtrezorcrypto.o \
$(BUILD_FW)/extmod/modtrezorcrypto/rand.o \ extmod/modtrezorcrypto/rand.o \
$(BUILD_FW)/extmod/modtrezorcrypto/ssss.o \ extmod/modtrezorcrypto/ssss.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/address.o \ extmod/modtrezorcrypto/trezor-crypto/address.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/aescrypt.o \ extmod/modtrezorcrypto/trezor-crypto/aescrypt.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/aeskey.o \ extmod/modtrezorcrypto/trezor-crypto/aeskey.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/aes_modes.o \ extmod/modtrezorcrypto/trezor-crypto/aes_modes.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/aestab.o \ extmod/modtrezorcrypto/trezor-crypto/aestab.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/base58.o \ extmod/modtrezorcrypto/trezor-crypto/base58.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/bignum.o \ extmod/modtrezorcrypto/trezor-crypto/bignum.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/bip32.o \ extmod/modtrezorcrypto/trezor-crypto/bip32.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/bip39.o \ extmod/modtrezorcrypto/trezor-crypto/bip39.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2b.o \ extmod/modtrezorcrypto/trezor-crypto/blake2b.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/blake2s.o \ extmod/modtrezorcrypto/trezor-crypto/blake2s.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/curves.o \ extmod/modtrezorcrypto/trezor-crypto/curves.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/ecdsa.o \ extmod/modtrezorcrypto/trezor-crypto/ecdsa.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \ extmod/modtrezorcrypto/trezor-crypto/ed25519-donna/ed25519.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/hmac.o \ extmod/modtrezorcrypto/trezor-crypto/hmac.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/nist256p1.o \ extmod/modtrezorcrypto/trezor-crypto/nist256p1.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/pbkdf2.o \ extmod/modtrezorcrypto/trezor-crypto/pbkdf2.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/ripemd160.o \ extmod/modtrezorcrypto/trezor-crypto/ripemd160.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/secp256k1.o \ extmod/modtrezorcrypto/trezor-crypto/secp256k1.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha2.o \ extmod/modtrezorcrypto/trezor-crypto/sha2.o \
$(BUILD_FW)/extmod/modtrezorcrypto/trezor-crypto/sha3.o extmod/modtrezorcrypto/trezor-crypto/sha3.o \
)
endif endif
# OBJ micropython/extmod/modtrezordebug # OBJ micropython/extmod/modtrezordebug
ifeq ($(MICROPY_PY_TREZORDEBUG),1) ifeq ($(MICROPY_PY_TREZORDEBUG),1)
OBJ_MOD += $(BUILD_FW)/extmod/modtrezordebug/modtrezordebug.o OBJ_MOD += $(addprefix $(BUILD_FW)/,\
extmod/modtrezordebug/modtrezordebug.o \
)
endif endif
# OBJ micropython/extmod/modtrezormsg # OBJ micropython/extmod/modtrezormsg
ifeq ($(MICROPY_PY_TREZORMSG),1) ifeq ($(MICROPY_PY_TREZORMSG),1)
OBJ_MOD += $(BUILD_FW)/extmod/modtrezormsg/modtrezormsg.o OBJ_MOD += $(addprefix $(BUILD_FW)/,\
extmod/modtrezormsg/modtrezormsg.o \
)
endif endif
# OBJ micropython/extmod/modtrezorui # OBJ micropython/extmod/modtrezorui
ifeq ($(MICROPY_PY_TREZORUI),1) ifeq ($(MICROPY_PY_TREZORUI),1)
CFLAGS_MOD += -DQR_MAX_VERSION=0 CFLAGS_MOD += -DQR_MAX_VERSION=0
OBJ_MOD += \ OBJ_MOD += $(addprefix $(BUILD_FW)/,\
$(BUILD_FW)/extmod/modtrezorui/display.o \ extmod/modtrezorui/display.o \
$(BUILD_FW)/extmod/modtrezorui/inflate.o \ extmod/modtrezorui/inflate.o \
$(BUILD_FW)/extmod/modtrezorui/font_bitmap.o \ extmod/modtrezorui/font_bitmap.o \
$(BUILD_FW)/extmod/modtrezorui/font_roboto_bold_20.o \ extmod/modtrezorui/font_roboto_bold_20.o \
$(BUILD_FW)/extmod/modtrezorui/font_roboto_regular_20.o \ extmod/modtrezorui/font_roboto_regular_20.o \
$(BUILD_FW)/extmod/modtrezorui/font_robotomono_regular_20.o \ extmod/modtrezorui/font_robotomono_regular_20.o \
$(BUILD_FW)/extmod/modtrezorui/modtrezorui.o \ extmod/modtrezorui/modtrezorui.o \
$(BUILD_FW)/extmod/modtrezorui/trezor-qrenc/qr_encode.o extmod/modtrezorui/trezor-qrenc/qr_encode.o \
)
endif endif
# OBJ micropython/extmod/modtrezorutils # OBJ micropython/extmod/modtrezorutils
ifeq ($(MICROPY_PY_TREZORUTILS),1) ifeq ($(MICROPY_PY_TREZORUTILS),1)
OBJ_MOD += $(BUILD_FW)/extmod/modtrezorutils/modtrezorutils.o OBJ_MOD += $(addprefix $(BUILD_FW)/,\
extmod/modtrezorutils/modtrezorutils.o \
)
endif endif
# OBJ micropython/extmod/modutime # OBJ micropython/extmod/modutime
ifeq ($(MICROPY_PY_UTIME),1) ifeq ($(MICROPY_PY_UTIME),1)
OBJ_MOD += $(BUILD_FW)/firmware/modutime.o OBJ_MOD += $(addprefix $(BUILD_FW)/,\
SRC_QSTR += $(SRCDIR_FW)/firmware/modutime.c firmware/modutime.o \
)
endif endif
# OBJ vendor/micropython # OBJ vendor/micropython
@ -297,11 +307,14 @@ OBJ_HAL += $(addprefix $(BUILD_MP)/,\
) )
# OBJ micropython/ # OBJ micropython/
OBJ_FW += $(addprefix $(BUILD_FW)/, \ OBJ_FIRMWARE += $(addprefix $(BUILD_FW)/, \
firmware/vendorheader.o \ firmware/vendorheader.o \
firmware/header.o \ firmware/header.o \
firmware/main.o \ firmware/main.o \
firmware/mphalport.o \ firmware/mphalport.o \
)
OBJ_TREZORHAL += $(addprefix $(BUILD_FW)/, \
trezorhal/common.o \ trezorhal/common.o \
trezorhal/flash.o \ trezorhal/flash.o \
trezorhal/rng.o \ trezorhal/rng.o \
@ -322,9 +335,10 @@ OBJ_FW += $(addprefix $(BUILD_FW)/, \
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==') FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==')
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_FW) $(OBJ_HAL) $(BUILD)/frozen_mpy.o OBJ = $(OBJ_MOD) $(OBJ_MP) $(OBJ_HAL) $(OBJ_TREZORHAL)
OBJ += $(OBJ_FIRMWARE)
OBJ += $(BUILD)/frozen_mpy.o
SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MP)) SRC_MP = $(patsubst $(BUILD_MP)%.o, $(SRCDIR_MP)%.c, $(OBJ_MP))
SRC_FW = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_FW))
SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD)) SRC_MOD = $(patsubst $(BUILD_FW)%.o, $(SRCDIR_FW)%.c, $(OBJ_MOD))
# comp flags # comp flags