diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-14 18:10:13 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-14 19:28:34 +0100 |
| commit | 872cf03f26c2801ae6c3008ce5fa0d7856f5f85d (patch) | |
| tree | 94809812b71ee286eb5b74c70e4d08fc4c8dc057 /makefile | |
| parent | ec769a83bde09c76bd6ad9ee7f391036dba5cd97 (diff) | |
libc: implement err/warn functions
Diffstat (limited to 'makefile')
| -rw-r--r-- | makefile | 38 |
1 files changed, 27 insertions, 11 deletions
@@ -55,6 +55,10 @@ ifdef M obj = $(M)/ endif +KCONFIG_CONFIG ?= .config + +-include ${KCONFIG_CONFIG} + # CFLAGS KBUILD_CFLAGS := -x c @@ -62,6 +66,7 @@ KBUILD_CFLAGS := -x c KBUILD_CFLAGS += -Wall -Wextra KBUILD_CFLAGS += -nostdinc KBUILD_CFLAGS += -target $(ARCH)-linux-eabi +KBUILD_CFLAGS += -ffreestanding KBUILD_CFLAGS += -I$(srctree)/include KBUILD_CFLAGS += -I$(srctree)/include/arch/$(ARCH) @@ -86,28 +91,32 @@ ifeq ($(CONFIG_WERROR),y) KBUILD_CFLAGS += -Werror endif +KBUILD_LDFLAGS := +KBUILD_ASFLAGS := ifeq ($(CONFIG_DEBUG),y) KBUILD_CFLAGS += -g -Og -fno-omit-frame-pointer -endif +else +KBUILD_CFLAGS += -O2 -fdata-sections -ffunction-sections +KBUILD_CFLAGS += -fno-unwind-tables -fomit-frame-pointer -KBUILD_ASFLAGS := +KBUILD_LDFLAGS += --gc-sections +KBUILD_LDFLAGS += --build-id=none +KBUILD_LDFLAGS += --as-needed +KBUILD_LDFLAGS += --strip-all +KBUILD_LDFLAGS += -z relro -z now -z noexecstack +KBUILD_LDFLAGS += --no-undefined +KBUILD_LDFLAGS += --icf=all + +KBUILD_ASFLAGS += +endif # Assembly does not need -nostdinc; clang warns it is unused. KBUILD_ASFLAGS += -target $(ARCH)-linux-eabi KBUILD_ASFLAGS += -I$(srctree)/include KBUILD_ASFLAGS += -I$(srctree)/include/arch/$(ARCH) -# LDFLAGS -KBUILD_LDFLAGS := - -KBUILD_LDFLAGS += --gc-sections -KBUILD_LDFLAGS += --build-id=none -KBUILD_LDFLAGS += --as-needed - PHONY := -KCONFIG_CONFIG ?= .config - export Q srctree MAKEFLAGS KCONFIG_CONFIG \ KBUILD_CFLAGS KBUILD_ASFLAGS KBUILD_LDFLAGS @@ -123,6 +132,13 @@ distclean: clean $(Q)$(MAKE) -C scripts/kconfig clean $(Q)rm -f compile_commands.json +info: + echo "CC: $(CC)" + echo "ARCH: $(ARCH)" + echo "CFLAGS: $(KBUILD_CFLAGS)" + echo "LDFLAGS: $(KBUILD_LDFLAGS)" + echo "ASFLAGS: $(KBUILD_ASFLAGS)" + $(KCONFIG_CONFIG): @echo >&2 '***' @echo >&2 '*** Configuration file "$@" not found!' |
