Currently, the compilation rules are mostly duplicated for normal vs
float vs ARM source files. This fix deduplicates the compilation logic
for these different "mode" of source files by using make's
Target-specific variable functionality.
https://www.gnu.org/software/make/manual/make.html#Target_002dspecific
This change was tested by using
[`bear`](https://github.com/rizsotto/Bear) to generate a
compile_commands.json file. The file was generated both before and after
the change and the json diff'd to ensure the generated compile commands
were not changed.
Change-Id: Id472045cc2e65bf542dfbf0ff52089be224c9d13
Have the arch define additional compiler flags to explicit support or
not support a floating point unit.
Add ability for modules to per file or for the whole module mark code
as needing floating point support.
Add default flags for arm64, riscv, and x86 toolchains.
Needed because gcc 12 is getting much more aggressive about using vector
instructions for non float code, so getting away with avoiding it was
no longer working.
Still not perfect: printf code is being compiled with float, so it's
possible to use floating point instructions inside core kernel or
interrupt handling code if a printf is used.
Possibly will have problems on architectures where mixing float and non
float code at the linker generates issues, but so far seems to be okay.
Instead of compiling each .c or .cpp or .S file into an equivalent .o file,
map it to a file with .c.o or .cpp.o extension.
IE,
foo.c -> foo.c.o
bar.cpp -> bar.cpp.o
Reason for this being that if you change the suffix of a file it'll
automatically pick it up and recompile.
Added architecture specific variables
ARCH_COMPILEFLAGS
ARCH_CFLAGS
ARCH_CPPFLAGS
ARCH_ASMFLAGS
These variables are passed directly to $(CC) command and
are supposed to have global but architecture specific
settings.
Change-Id: I0929afacb4ad5229f503217ee370e0a84a15f35d
This seems to fix a long-standing issue that occurs if a header file
is removed or moved to a new location, causing the make system to
bomb out on the next build due to stale .d file dependencies on the old
location. -MP adds empty rules for all of the .h files to the .d file
which at least lets it get past this stage.
To be more consistent, rename make variable INCLUDES to GLOBAL_INCLUDES.
Also remove the need to put -I in front of each field, the make system
will do that for you.
To fix your module makefiles:
-Change INCLUDES -> GLOBAL_INCLUDES
-Remove -I prefix
-Each module's rules.mk defines a seperate linkage unit. Each
module can have a private set of CFLAGS, DEFINES, INCLUDES, and so
forth.
-Files to be compiled are now added by source, not object.
Most rules.mk files can be converted easily by following these steps:
1) add 'MODULE := $(LOCAL_DIR)' near the top of the file
2) change OBJS += to MODULE_SRCS += and list source files instead of .os
3) add 'include make/module.mk' at the bottom of the file
See make/module.mk for directions.