diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2012-12-10 21:07:18 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2013-01-02 20:44:11 +0100 |
commit | adfc622cc1bbfeaa098b61862a953fef13b6e00c (patch) | |
tree | 559493b3a5df6d8c638a9e5ca50ddee691cc7217 /src | |
parent | 3ee1beb8bf4c1ca87c88d12a8cd1f24d096aee88 (diff) |
fw/build: Allow applications to filter environments
We use an external python script to solve which env to build, to
mix board and app env list
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/firmware/Makefile | 5 | ||||
-rw-r--r-- | src/target/firmware/Makefile.inc | 2 | ||||
-rwxr-xr-x | src/target/firmware/solve_envs.py | 41 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile index e8b11142..28344e1f 100644 --- a/src/target/firmware/Makefile +++ b/src/target/firmware/Makefile @@ -86,6 +86,11 @@ BOARD_se_j100_ENVIRONMENTS=$(compal_COMMON_ENVIRONMENTS) # List of all applications (meant to be overridden on command line) APPLICATIONS?=hello_world compal_dsp_dump layer1 loader chainload rssi +# Applications specific env requirements +APP_chainload_ENVIRONMENTS=compalram +APP_loader_ENVIRONMENTS=compalram highram +APP_rssi_ENVIRONMENTS=* -compalram + # Various objects that are currently linked into all applications FLASH_OBJS=flash/cfi_flash.o ABB_OBJS=abb/twl3025.o diff --git a/src/target/firmware/Makefile.inc b/src/target/firmware/Makefile.inc index cb2374e0..90498989 100644 --- a/src/target/firmware/Makefile.inc +++ b/src/target/firmware/Makefile.inc @@ -134,7 +134,7 @@ $(foreach app,$(APPLICATIONS), \ $(foreach app,$(APPLICATIONS), \ $(foreach brd,$(BOARDS), \ - $(foreach env,$(BOARD_$(brd)_ENVIRONMENTS), \ + $(foreach env,$(shell ./solve_envs.py "$(BOARD_$(brd)_ENVIRONMENTS)" "$(APP_$(app)_ENVIRONMENTS)"), \ $(eval $(call APPLICATION_BOARD_ENVIRONMENT_template,$(app),$(brd),$(env)))))) diff --git a/src/target/firmware/solve_envs.py b/src/target/firmware/solve_envs.py new file mode 100755 index 00000000..d6414d69 --- /dev/null +++ b/src/target/firmware/solve_envs.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import sys + +def parse(s): + return set([x.strip() for x in s.split() if x.strip()]) + + +def solve(board_envs, app_envs): + if not app_envs: + return board_envs + + envs = set() + + if '*' in app_envs: + envs.update(board_envs) + app_envs.discard('*') + + for e in app_envs: + if e.startswith('-'): + envs.discard(e[1:]) + elif e in board_envs: + envs.add(e) + + return envs + + +def main(name, board_envs, app_envs): + # Parse args + board_envs = parse(board_envs) + app_envs = parse(app_envs) + + # Solve + envs = solve(board_envs, app_envs) + + # Result + print ' '.join(envs) + + +if __name__ == '__main__': + main(*sys.argv) |