Skip to content

Commit

Permalink
Simplifies optimization / debugging levels
Browse files Browse the repository at this point in the history
Now only use them for compilation since they don't do anything on other steps of the build.
  • Loading branch information
apaillier-ledger committed Jan 22, 2025
1 parent fdf40de commit 903fb65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
10 changes: 10 additions & 0 deletions Makefile.defines
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ ifeq ($(SYSROOT),)
endif
CFLAGS += --sysroot="$(SYSROOT)"

# optimization and debugging levels
ifneq ($(DEBUG),0)
OPTI_LVL = g
DBG_LVL = 3
else
OPTI_LVL = z
DBG_LVL = 0
endif
CFLAGS += -O$(OPTI_LVL) -g$(DBG_LVL)

CFLAGS += -fomit-frame-pointer -momit-leaf-frame-pointer

CFLAGS += -fno-common -mlittle-endian
Expand Down
21 changes: 0 additions & 21 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -93,25 +93,4 @@ OBJECTS_DIR += $(sort $(dir $(OBJECT_FILES)))
DEPEND_FILES = $(subst $(OBJ_DIR), $(DEP_DIR), $(addsuffix .d, $(basename $(OBJECT_FILES))))
DEPEND_DIR += $(sort $(dir $(DEPEND_FILES)))

# optimization and debug levels
# this should be in Makefile.defines, but $(AS) is not yet defined at that point
ifneq ($(DEBUG),0)
OPTI_LVL = -Og
OPTI_ALVL = $(OPTI_LVL)
DBG_LVL = -g3
else
OPTI_LVL = -Oz
ifeq ($(AS),$(CLANGPATH)clang)
OPTI_ALVL = $(OPTI_LVL)
else
# GCC assembler does not handle -Oz
OPTI_ALVL = -Os
endif
DBG_LVL = -g0
endif
# at the beginning so they can be overridden by apps
CFLAGS := $(OPTI_LVL) $(DBG_LVL) $(CFLAGS)
AFLAGS := $(OPTI_ALVL) $(DBG_LVL) $(AFLAGS)
LDFLAGS := $(OPTI_LVL) $(DBG_LVL) $(LDFLAGS)

include $(BOLOS_SDK)/Makefile.rules_generic

0 comments on commit 903fb65

Please sign in to comment.