-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking: remove harmful use of export
in make and immediate evaluation
#10850
Labels
Area: build system
Area: Build system
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Type: tracking
The issue tracks and organizes the sub-tasks of a larger effort
Comments
cladmi
added
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Area: build system
Area: Build system
Type: tracking
The issue tracks and organizes the sub-tasks of a larger effort
labels
Jan 23, 2019
This was referenced Jan 23, 2019
Exporting |
This was referenced Feb 25, 2019
This was referenced Jun 3, 2019
cladmi
changed the title
Tracking: remove harmfull use of
Tracking: remove harmful use of Jun 7, 2019
export
in make and immediate evaluationexport
in make and immediate evaluation
This was referenced Aug 27, 2019
This was referenced Sep 12, 2019
This was referenced Jan 2, 2020
This was referenced Jan 21, 2020
Merged
This was referenced Feb 24, 2020
This was referenced Mar 6, 2020
This was referenced Mar 26, 2020
@fjmolinas do you think issue could be closed ? It seems all points were addressed. |
Not sure, moving the to |
Let's see if someone complains when I close this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: build system
Area: Build system
Type: bug
The issue reports a bug / The PR fixes a bug (including spelling errors)
Type: tracking
The issue tracks and organizes the sub-tasks of a larger effort
Description
Many variables are exported using
export VARIABLE
without even knowing why, the impact, or even be needed. In the same time, many variables are evaluated using:=
instead of usingdeferred
variables.Guess why calling
make clean
is slow ? All these variables/shell call must be evaluated for each target called even if the targett is not using it at all.I tried preventing changing these without reasons, but keeping them in this wrong state by default, is causing me issues in several places. I want to start getting rid of them on a methodical way instead of currently working it around.
Listing them all
I am personally tracking them in https://ci-ilab.imp.fu-berlin.de/job/RIOT%20cleanup%20warnings/
Steps
List variables where export or direct evaluation can directly be removed here == only used inside
Makefile.include
and remove themmakefiles/vars.inc.mk: do not export LINKFLAGS #10853cpu/atmega_common: do not export LINKFLAGS #10854generate-xcompile-toolchain.sh
so for building packages in general, it is also usingLFLAGS
which is not mapped toLINKFLAGS
.Makefile.base
make: do not locally export compilation variables #12098--std=c99
yet)TERMPROG
TERMFLAGS
:boards/nz32-sc151/Makefile.include:export TERMFLAGS = -p $(PORT)
boards/nz32-sc151: do not blindly set TERMFLAGS #11065FLASHER/FFLAGS/DEBUGGER/DEBUGGER_FLAGS/DEBUGSERVER/DEBUGSERVER_FLAGS/RESET/RESET_FLAGS
make: remove exports for flash debug reset #11554PORT
makefiles: remove exports so that PORT is not evaluated if it's not needed. #104400.1
seconds. Everytimemake
is run.CFLAGS_WITH_MACROS
and only evaluategit describe
command when needeed makefiles: Introduce GIT_VERSION and use it for RIOT_VERSION #11881Only export in
makefiles/vars.inc.mk
for variables that currently really need to be exportedVariables that need to be exported to sub-builds need a mechanism to say who gets it
makefiles/utils/variables: add functions to help managing variables makefiles/utils/variables: add functions to help managing variables #11664
Variables that are transparently given to scripts even if only one needs it
board
instead of in theflasher
Cleaning up
git grep -e '$(VARIABLE)' -e '${VARIABLE}'
and verify uses are indeed only in directly included makefilescheck_not_exporting_variables()
checked variables to prevent re-adding the export https://github.com/RIOT-OS/RIOT/blob/master/dist/tools/buildsystem_sanity_check/check.shexport VARIABLE
must be removed and not justexport
removedThis has different consequences:
Evaluation when not needed
Using an
export
on a variable means the value will be evaluated even for rules that do not use the variable.This causes issues for example with listing
tty
devices, evaluatingINCLUDES
and gettingGCC_INCLUDES_DIRS
It also causes evaluation on the host machine when only the docker container should be doing it. It happened with
avr-ld
for example, somechecks
being performed on the host machine, sayingobjcopy not found
.Sub builds
When trying to call
make
inside ofmake
many variables from the first build are sent to the second one.Variables that can change a build
As everything is exported, it is hard to know what can have an impact on a build result.
Having it in control would simplify documenting what should and what should not be available.
The default behavior has become harmful
The default case has been to always use
:=
orexport
even when it does not make sense, and it gets merged without even reviewing why there is anexport
there.Examples
GLOBAL_GOALS
has it should not evaluate the rest of the build system because it isslow
or causes isssuesRelated issues
I am starting to build on a machine that has nothing but docker and the build system complains about these things.
The text was updated successfully, but these errors were encountered: