1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 00:09:46 +01:00
Commit Graph

95 Commits

Author SHA1 Message Date
Mikolai Gütschow
b96536d1ba
Makefiles: (application) support for SRC in subfolders 2024-11-01 11:53:55 +01:00
MrKevinWeiss
6d39d14845
*Makefile.base: Remove TEST_KCONFIG use 2024-03-26 14:53:40 +01:00
Daniel Lockau
9c9d739634 Makefile.{include,base},pkg/nanopb: fix target dependencies & code generation 2024-03-12 09:50:23 +01:00
NikLeberg
140824e69c buildsystem/pkg: expand paths early 2022-01-30 19:58:52 +01:00
Francisco Molina
cc001a81e1 Makefile.base: add SUBMODULE_NO_SRC to excluded a selected SUBMODULE *.c
This allows for SUBMODULE PSEUDOMODULES to conditionally not be linked
to an existing *.c file.
2021-11-16 22:40:11 +01:00
Leandro Lanzieri
e8ad257d66
Makefile.base: do not clean objects of bindist modules 2021-10-13 14:22:51 +02:00
Leandro Lanzieri
452333cb36
Makefile.base: cleanup non selected source object files 2021-10-05 13:01:18 +02:00
MrKevinWeiss
652e4f41c1
cpp: Use modules for cpp and libstdcpp
Also add better error message when kconfig or make includes a .cpp without cpp module.
2021-07-02 15:11:10 +02:00
chrysn
c99bb55e68
Merge pull request #16129 from maribu/compile_commands_json
build system: add compile-commands target to generate compile_commands.json
2021-04-14 18:10:28 +02:00
Marian Buschsieweke
a07dac9ad1
build system: add new compile-commands make target
By running make compile-commands a `compile_commands.json` in the RIOT base
directory. With the environment variable `COMPILE_COMMANDS` the path of
this file can be changed to a custom location.

The `compile_commands.json` will contain the exact compile command, but
as additional flag `-I/usr/$(TARGET)/include` is added to work around
`clangd` not being able to locate the newlib system headers. The
additional includes can be overwritten using the environment variable
`COMPILE_COMMANDS_EXTRA_INCLUDES`.
2021-04-14 14:51:46 +02:00
Francisco Molina
19ae0d746a
Makefile: enable SECONDEXPANSION globally for modules and applications 2021-03-16 11:21:07 +01:00
Leandro Lanzieri
e80bb4b3dc
makefile: add a check for real modules 2020-09-04 15:01:16 +02:00
Leandro Lanzieri
81cb769cad
makefiles: avoid building archives when compiling 2020-09-04 15:01:10 +02:00
Cenk Gündoğan
132b7328e3
make: kconfig: use fixdep to enable incremental compilation 2020-08-11 09:47:32 +02:00
Cenk Gündoğan
f49eb4305c
dist: tools: import fixdep from linux 2020-08-10 12:17:59 +02:00
Marian Buschsieweke
c1ad435668
Makefile.base: Error for C++ code w/w cpp feature
If external modules use C++ code and forget to require the `cpp` feature,
linking will still take places using $(CC). This commit adds a check if C++ code
was detected without the feature `cpp` being used, now the build is aborted
with a helpful error message rather than a linker error.
2020-07-23 20:18:33 +02:00
Francisco Molina
2331448644
Makefile: remove usage of SUBMODULES_NOFORCE
With #10970 only existing *.c files will be added to SRC when using
the SUBMODULES mechanism, so SUBMODULES_NOFORCE (used to filter out
non existing source files) is now redundant so remove the usage.
2020-04-15 12:11:44 +02:00
Francisco
623381f9d3
Merge pull request #10970 from miri64/make/fix/pseudo-submodules
make: Allow for true pseudo-submodules
2020-04-15 09:42:30 +02:00
Martine Lenders
744fbc5cad
make: Allow for true pseudo-submodules
When providing a pseudo-submodule for a module already using the
`SUBMODULES` mechanism to provide submodules, it is not possible to
create a true pseudo-module as submodule (i.e. one without any code on
its own), since the build system currently always expects there to be a
C file `module_submodule.c`.

This removes this requirement.
2020-04-14 18:34:50 +02:00
Leandro Lanzieri
d1fcc17c09 Makefile.base: Assign module name with simple expansion 2020-02-04 13:14:17 +01:00
Leandro Lanzieri
9c8b7a064b makefiles/kconfig: Only run Kconfig if could generate configurations
This adds a check to decide if Kconfig should run on a build. It will
run if any of the following conditions is true:
- A file with '.config' extension is present in the application folder
- A 'Kconfig' file is present in the application folder
- A previous configuration file is present (e.g. from a previous call to
  menuconfig)
- menuconfig is being called

This assumes that Kconfig will not generate any default configurations
just from the Kconfig files outside the application folder (i.e. module
configuration via Kconfig is disabled by default). Should this change,
the check would not longer be valid, and Kconfig would have to run on
every build.
2019-12-18 09:46:43 +01:00
72bed868db
Makefile.base: add variable to exclude cpp files from build 2019-12-04 20:10:55 +01:00
44974ac106
Makefile.base: make cpp file extension configurable 2019-12-04 20:10:55 +01:00
Leandro Lanzieri
1655001d85 makefiles: Add Kconfig related targets and dependencies
- The autoconf.h header file, generated with the current Kconfig
  configurations, is added as a build dependency.

- autoconf.h depends on the proper tool (genconfig) and a Kconfig.dep
  which contains the dependencies for the given application and board,
  this is generated from $(USEMODULE).

- The menuconfig target is added, to allow the configuration of modules
  using the Kconfig system.
2019-12-04 15:23:51 +01:00
Leandro Lanzieri
dc845841f0 Makefile.base: Set targets of *.d files to absolute object path
By passing the -MT flag with the absolute path to the object we make
sure that the compiler generates dependency files with rules that match
our building rules.
2019-11-29 18:52:48 +01:00
a100c1c0ea makefiles/blob.inc.mk: introduce blob -> hdr utility makefile 2019-11-18 17:53:47 +01:00
1ca277d914 make: enable SECONDEXPANSION for module/application builds 2019-11-14 12:12:18 +01:00
cd18dad5ca pkg: introduce nanoPb Protocol Buffers library 2019-10-18 22:34:28 +02:00
4c3d473e4e make: add GENSRC (generated source files) support 2019-10-18 22:34:28 +02:00
Gaëtan Harter
a581c2c8ce
Makefile.base: implement relative path linking without 'realpath'
This fixes the following issues:

* Use of 'realpath' not supported on mac
* Call of 'realpath' once for each file instead of one per archive
* Do not trigger 'llvm-ar' bug when invoked in the object directory.
    llvm-ar rcTs ../m.a obj.o  # Bugged
    llvm-ar rcTs m.a m/obj.o   # working

Using relative path linking is required to have a valid thin archive
path in the host when build in docker.
2019-09-16 15:52:36 +02:00
Juan Carrano
24ddf285d2 Makefile.base: use thin static archives.
Normal, or thick archives contain a copy of the object code. Thin
archives, on the contrary, are just an index to the .o files.

This patch does two things:

1. Change ARFLAGS to enable the "T" options.
2. Call AR with all relative paths.

The second step is necessary because the build system handles all
absolute paths. If the index in the thin archive contains absolute
paths, archives created in docker are no usable outside, and moving
the objects breaks the archive.

If all arguments to AR are relative, the resulting archive contains
filenames *relative to the .a file* and nothing should break as long
as the relative location of the .a and .o remains unchanged.

Compilation time is unchanged, but disc usage is reduced by approximately
50%. These are the result of a full RIOT build:

| Thin Archive   |  no     |  yes  | Savings (%) |
| -------------- | ------: | ----: | ----------- |
| pkg (10e6 KiB) | 1 790   | 905   | 49%         |
| Non pkg        |    71   |  71   | 1%          |
| Total          | 1 812   | 976   | 46 %        |
2019-09-10 11:21:42 +02:00
cladmi
238e37bdee
Makefile.base: define 'clean' as .PHONY 2018-08-22 16:25:37 +02:00
61f1b941ce make: replace curly braces with parenthesis 2018-03-22 20:43:15 +01:00
Gaëtan Harter
7c85e6e0e9 Makefile.base: fix AR keeping removed source files objects
AR incrementally adds file without removing files.
If a c file is deleted or disabled(submodule removal) it is not removed from
archive and still ends up in the final elf file.

This fix removes the need to do 'make clean' for this case.

However it will break cases where an APPLICATION and a MODULE or two modules
have the same name and only worked because source files names where different.
2018-03-14 12:29:10 +01:00
Joakim Nohlgård
7e3482eea0
Merge pull request #7933 from cladmi/pr/asssmobj_depends_to_header
Makefile.base: Add missing dep to RIOTBUILD_CONFIG_HEADER_C
2017-11-04 23:20:21 +01:00
Gaëtan Harter
1a6b492438 Makefile.base: Fix indentation to two spaces 2017-11-03 13:51:51 +01:00
Gaëtan Harter
3d2ed681e3 Makefile.base: Add missing dep to RIOTBUILD_CONFIG_HEADER_C
Assembly files '.S' are compiled with a subset of CFLAGS.
This means also `-include '$(RIOTBUILD_CONFIG_HEADER_C)'` so they should be
recompiled when it updates.
2017-11-03 13:46:49 +01:00
3711a6d406 Merge pull request #6780 from kaspar030/add_submodules
make: add submodule support
2017-03-29 07:27:20 +02:00
933a7a3efe make: add submodule support 2017-03-28 20:50:47 +02:00
c442cbcc23 make: Makefile.base: don't collect wildcard sources if NO_AUTO_SRC is nonempty 2017-03-22 22:22:06 +01:00
Joakim Nohlgård
d90f33e654 make: Add support for specifying a different compiler for assembler 2017-03-01 14:46:59 +01:00
47f6ff3056 Merge pull request #6237 from kaspar030/rename_AD_to_Q
make: rename AD to Q
2017-01-17 16:16:02 +01:00
fd07b5fd27 make: introduce QQ, use when doing CI build 2016-12-22 23:53:51 +01:00
f44763f346 make: adapt Makefiles to AD -> Q rename 2016-12-22 12:12:38 +01:00
Joakim Nohlgård
e2dc99f464 make: Place C++ includes before C includes when compiling C++
Fixes some errors when specifying system C++ include directories where
the C++ headers need to #include_next related C headers.
2016-12-21 13:05:15 +01:00
560a509036 make: remove trailing slash from BINDIR variable 2016-10-18 23:27:59 +02:00
1f9a87972b make: allow per-file conditional LTO compile 2016-08-29 13:30:17 +02:00
Joakim Nohlgård
77a15e7886 make: Place most configuration macros in a separate file instead of on the command line 2016-07-05 11:22:58 +02:00
Joakim Nohlgård
275b366825 Makefile.base: Add separate CXXINCLUDES for C++ specific header directories 2016-05-31 22:03:04 +02:00
3c56b49df6 make: use ccache if environment variable is set 2015-05-29 09:45:40 +02:00