11 Commits

Author SHA1 Message Date
Matt Schulte
6414dd13b0 [make] Remove duplicate compile rules for modes
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
2023-12-04 00:56:39 -08:00
Travis Geiselbrecht
6462cbf51c [arch][fpu] add ability to specify per file or module if code needs fpu
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.
2022-07-17 16:32:24 -07:00
Travis Geiselbrecht
649ca7dd54 [make] encode the source file extension into the .o file
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.
2021-01-14 18:43:18 -08:00
Travis Geiselbrecht
96d98bc160 [make] replace echo commands with $(info)
Seems to result in less forks since it doesn't need to run an echo
binary.
2018-12-01 11:59:42 -08:00
Søren Gjesse
4dfc63d476 [make] Add support for C++ files with extension .cc 2016-04-14 19:24:46 +02:00
Michael Ryleev
21a5fd3322 [make] Add support for ARCH_XXX flags
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
2015-03-19 18:01:10 -07:00
Travis Geiselbrecht
d06139b4fb [make] add -MP to the compile line
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.
2014-11-05 12:59:02 -08:00
Travis Geiselbrecht
e14309a95b [make] add GLOBAL_SRCDEPS variable
Build a phony rule that depends on a delay evaluated SRCDEPS
variable at the end of the build so that modules that add to
it are properly tracked.
2013-07-31 12:13:11 -07:00
Travis Geiselbrecht
e002c58b59 [make] rename INCLUDES -> GLOBAL_INCLUDES
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
2013-06-07 22:26:06 -07:00
Travis Geiselbrecht
34b56263d3 [make] fix compile.mk to properly use MODULE_INCLUDES 2013-02-16 15:06:24 -08:00
Travis Geiselbrecht
734f32b143 [make] better modularize the build system
-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.
2012-08-31 15:52:24 -07:00