From ba39bdba76e936febf8d3f7e787a7df0aab1cf8a Mon Sep 17 00:00:00 2001 From: Christopher Kormanyos Date: Tue, 19 Dec 2023 07:12:25 +0100 Subject: [PATCH] Various make system cleanups --- .gitignore | 1 + ref_app/target/app/make/app_make.gmk | 32 ++++++++++++++----- ref_app/target/app/make/app_make_linux.gmk | 36 ++++++++++++++++------ ref_app/target/micros/avr/make/avr.ld | 15 +++------ 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 37286427f..8c09f9757 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ ref_app/ref_app.vcxproj.user ref_app/target.vcxproj.user ref_app/tmp/ ref_app/x64 +ref_app/bin/ diff --git a/ref_app/target/app/make/app_make.gmk b/ref_app/target/app/make/app_make.gmk index 68e165fc6..353310306 100644 --- a/ref_app/target/app/make/app_make.gmk +++ b/ref_app/target/app/make/app_make.gmk @@ -26,7 +26,21 @@ # punctuation # ------------------------------------------------------------------------------ -DQUOTE = \" +DQUOTE := \" +$(DQUOTE) := \" + +SEMICOLON := ; +$(SEMICOLON) := ; + +DOLLAR := $$ +$(DOLLAR) := $$ + +# ------------------------------------------------------------------------------ +# null device +# ------------------------------------------------------------------------------ + +NULL_DEVICE := NUL +$(NULL_DEVICE) := NUL # ------------------------------------------------------------------------------ # paths @@ -217,7 +231,7 @@ clean_prj: @-$(MKDIR) -p $(PATH_OBJ) @-$(MKDIR) -p $(PATH_ERR) @-$(MKDIR) -p $(PATH_LST) - @-$(RM) -r $(PATH_BIN) 2>NUL + @-$(RM) -r $(PATH_BIN) 2>$(NULL_DEVICE) @-$(MKDIR) -p $(PATH_BIN) @@ -231,10 +245,10 @@ clean_all: @-$(MKDIR) -p $(PATH_OBJ) @-$(MKDIR) -p $(PATH_ERR) @-$(MKDIR) -p $(PATH_LST) - @-$(RM) -r $(PATH_OBJ) 2>NUL - @-$(RM) -r $(PATH_ERR) 2>NUL - @-$(RM) -r $(PATH_LST) 2>NUL - @-$(RM) -r $(PATH_BIN) 2>NUL + @-$(RM) -r $(PATH_OBJ) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_ERR) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_LST) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_BIN) 2>$(NULL_DEVICE) @-$(MKDIR) -p $(PATH_BIN) @@ -244,6 +258,7 @@ clean_all: .PHONY: version version: # Print the GNU make version and the compiler version + @$(ECHO) @$(ECHO) +++ Print GNUmake version @$(MAKE) --version @$(ECHO) @@ -254,11 +269,14 @@ version: @$(ECHO) $(C_INCLUDES) @$(ECHO) @$(ECHO) +++ Print compiler include paths (for VisualStudio(R) browsing) - @$(ECHO) $(addsuffix ;,$(subst -I,$$\(ProjectDir\)/, $(C_INCLUDES))) + @$(ECHO) $(addsuffix $(SEMICOLON),$(subst -I,$$\(ProjectDir\)/, $(C_INCLUDES))) @$(ECHO) @$(ECHO) +++ Print compiler definitions @$(ECHO) $(C_DEFINES) @$(ECHO) + @$(ECHO) +++ Print compiler CXXFLAGS flags + @$(ECHO) $(CXXFLAGS) + @$(ECHO) # ------------------------------------------------------------------------------ diff --git a/ref_app/target/app/make/app_make_linux.gmk b/ref_app/target/app/make/app_make_linux.gmk index 3e8b674d5..ba57fa9da 100644 --- a/ref_app/target/app/make/app_make_linux.gmk +++ b/ref_app/target/app/make/app_make_linux.gmk @@ -1,5 +1,5 @@ # -# Copyright Christopher Kormanyos 2007 - 2022. +# Copyright Christopher Kormanyos 2007 - 2023. # Distributed under the Boost Software License, # Version 1.0. (See accompanying file LICENSE_1_0.txt # or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -26,7 +26,21 @@ # punctuation # ------------------------------------------------------------------------------ -DQUOTE = \" +DQUOTE := \" +$(DQUOTE) := \" + +SEMICOLON := ; +$(SEMICOLON) := ; + +DOLLAR := $$ +$(DOLLAR) := $$ + +# ------------------------------------------------------------------------------ +# null device +# ------------------------------------------------------------------------------ + +NULL_DEVICE := /dev/null +$(NULL_DEVICE) := /dev/null # ------------------------------------------------------------------------------ # paths @@ -136,7 +150,7 @@ C_INCLUDES = $(TGT_INCLUDES) \ ifeq ($(WARN_FLAGS),) WARN_FLAGS = -Wall \ -Wextra \ - -pedantic \ + -Wpedantic \ -Wmain \ -Wundef \ -Wconversion \ @@ -212,7 +226,7 @@ clean_prj: @-$(MKDIR) -p $(PATH_OBJ) @-$(MKDIR) -p $(PATH_ERR) @-$(MKDIR) -p $(PATH_LST) - @-$(RM) -r $(PATH_BIN) > NUL 2> NUL + @-$(RM) -r $(PATH_BIN) 2>$(NULL_DEVICE) @-$(MKDIR) -p $(PATH_BIN) @@ -226,10 +240,10 @@ clean_all: @-$(MKDIR) -p $(PATH_OBJ) @-$(MKDIR) -p $(PATH_ERR) @-$(MKDIR) -p $(PATH_LST) - @-$(RM) -r $(PATH_OBJ) > NUL 2> NUL - @-$(RM) -r $(PATH_ERR) > NUL 2> NUL - @-$(RM) -r $(PATH_LST) > NUL 2> NUL - @-$(RM) -r $(PATH_BIN) > NUL 2> NUL + @-$(RM) -r $(PATH_OBJ) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_ERR) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_LST) 2>$(NULL_DEVICE) + @-$(RM) -r $(PATH_BIN) 2>$(NULL_DEVICE) @-$(MKDIR) -p $(PATH_BIN) @@ -239,6 +253,7 @@ clean_all: .PHONY: version version: # Print the GNU make version and the compiler version + @$(ECHO) @$(ECHO) +++ Print GNUmake version @$(MAKE) --version @$(ECHO) @@ -251,6 +266,9 @@ version: @$(ECHO) +++ Print compiler definitions @$(ECHO) $(C_DEFINES) @$(ECHO) + @$(ECHO) +++ Print compiler CXXFLAGS flags + @$(ECHO) $(CXXFLAGS) + @$(ECHO) # ------------------------------------------------------------------------------ @@ -259,7 +277,7 @@ version: $(APP).$(TGT_SUFFIX) : $(LINKER_DEFINITION_FILE) $(FILES_O) @-$(ECHO) +++ linking application to generate: $(APP).$(TGT_SUFFIX) @-$(CC) $(LDFLAGS) $(FILES_O) -o $(APP).$(TGT_SUFFIX) -ifneq ($(GCC_TARGET),riscv64-unknown-elf) +ifneq ($(findstr risc,$(GCC_TARGET)),) @-$(ECHO) +++ generating assembly list file: $(APP).lss @-$(OBJDUMP) -h -S $(APP).$(TGT_SUFFIX) > $(APP).lss endif diff --git a/ref_app/target/micros/avr/make/avr.ld b/ref_app/target/micros/avr/make/avr.ld index 2475c3d2b..23b93a57f 100644 --- a/ref_app/target/micros/avr/make/avr.ld +++ b/ref_app/target/micros/avr/make/avr.ld @@ -68,13 +68,12 @@ SECTIONS . = ALIGN(2); *(.text*) . = ALIGN(2); + *(.rodata) + . = ALIGN(2); + *(.rodata*) + . = ALIGN(2); } > ROM - .text : - { - . = ALIGN(0x10); - } > ROM = 0xAAAA - . = 0x00800100; . = ALIGN(2); @@ -88,12 +87,6 @@ SECTIONS *(.data*) . = ALIGN(2); KEEP (*(.data*)) - *(.rodata) /* Do *NOT* move this! Include .rodata here if gcc is used with -fdata-sections. */ - . = ALIGN(2); - KEEP (*(.rodata)) - *(.rodata*) - . = ALIGN(2); - KEEP (*(.rodata*)) _data_end = .; } > RAM AT > ROM