diff --git a/Makefile b/Makefile index 3255c719..6f28e2c9 100644 --- a/Makefile +++ b/Makefile @@ -74,4 +74,5 @@ help: make install create raspi kernel and mount it on a bootable partition\n\ make prepare-fs create directories for the filesystem\n\n"\ \n\ - Use 'make V=1' for verbose build output. + Use 'make V=1' for verbose build output.\n\ + Use 'make RELEASE=1' for optimized release build (currently broken). diff --git a/common.mk b/common.mk index 676b839e..c4ae8b5c 100644 --- a/common.mk +++ b/common.mk @@ -6,10 +6,16 @@ AR := $(ARCH)-ar OBJCOPY := $(ARCH)-objcopy COMMON_FLAGS ?= -ffreestanding -nostdlib -fno-exceptions -fno-unwind-tables \ - -fno-asynchronous-unwind-tables -g -O0 -Wall -Wextra \ + -fno-asynchronous-unwind-tables -Wall -Wextra \ -Wno-unused-parameter -Wno-address-of-packed-member \ -mcpu=cortex-a72 +ifeq ($(RELEASE), 1) + COMMON_FLAGS += -O3 -s -DNDEBUG +else + COMMON_FLAGS += -O0 -g +endif + CFLAGS_BASE ?= $(COMMON_FLAGS) -std=c17 CXXFLAGS_BASE ?= $(COMMON_FLAGS) -fno-rtti LDFLAGS_BASE ?=