more style: sharing variable setting include/source files with scripts

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

more style: sharing variable setting include/source files with scripts

Robert P. J. Day-2

  i *think* i know that this will work, but i'd like to make sure.
in current project, there are *numerous* files named "config.include"
that are included from numerous Makefiles to set common variables.
those included files are in Makefile format, thusly:

  DEFAULT_CONFIG_DIR:=$(REPO_ROOT)/tools/default
  BOARD_CONFIG_DIR:=$(BOARD_DIR)/project-spec/configs
  CONFIGS_WORK_DIR:=$(REPO_ROOT)/configs/$(BOARD)
  IMAGE_WORK_DIR:=$(REPO_ROOT)/image/$(BOARD)
  BOOTIMG_WORK_DIR:=$(REPO_ROOT)/bootimg/$(BOARD)
  KERNEL_WORK_DIR:=$(REPO_ROOT)/kernel/$(BOARD)

AFAICT, all of the settings are immediate expansion, nothing is
deferred -- they're pretty much for (as you can see) setting variables
to identify working directories.

  obvious problem is that all of that information would be useful for
shell scripts as well, but that format is, of course, not compatible
with scripts. so my suggestion was, for files like that, rewrite them
all as (with curly braces):

  DEFAULT_CONFIG_DIR=${REPO_ROOT}/tools/default
  BOARD_CONFIG_DIR=${BOARD_DIR}/project-spec/configs
  CONFIGS_WORK_DIR=${REPO_ROOT}/configs/${BOARD}
  IMAGE_WORK_DIR=${REPO_ROOT}/image/${BOARD}
  BOOTIMG_WORK_DIR=${REPO_ROOT}/bootimg/${BOARD}
  KERNEL_WORK_DIR=${REPO_ROOT}/kernel/${BOARD}

at which point, they should be includable in Makefiles and sourceable
from scripts, yes?

  do i understand that correctly?

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

Reply | Threaded
Open this post in threaded view
|

Re: more style: sharing variable setting include/source files with scripts

Jaap Fieret-2
FREE

Jaap

> Op 31 okt. 2019 om 16:25 heeft Robert P. J. Day <[hidden email]> het volgende geschreven:
>
> 
>  i *think* i know that this will work, but i'd like to make sure.
> in current project, there are *numerous* files named "config.include"
> that are included from numerous Makefiles to set common variables.
> those included files are in Makefile format, thusly:
>
>  DEFAULT_CONFIG_DIR:=$(REPO_ROOT)/tools/default
>  BOARD_CONFIG_DIR:=$(BOARD_DIR)/project-spec/configs
>  CONFIGS_WORK_DIR:=$(REPO_ROOT)/configs/$(BOARD)
>  IMAGE_WORK_DIR:=$(REPO_ROOT)/image/$(BOARD)
>  BOOTIMG_WORK_DIR:=$(REPO_ROOT)/bootimg/$(BOARD)
>  KERNEL_WORK_DIR:=$(REPO_ROOT)/kernel/$(BOARD)
>
> AFAICT, all of the settings are immediate expansion, nothing is
> deferred -- they're pretty much for (as you can see) setting variables
> to identify working directories.
>
>  obvious problem is that all of that information would be useful for
> shell scripts as well, but that format is, of course, not compatible
> with scripts. so my suggestion was, for files like that, rewrite them
> all as (with curly braces):
>
>  DEFAULT_CONFIG_DIR=${REPO_ROOT}/tools/default
>  BOARD_CONFIG_DIR=${BOARD_DIR}/project-spec/configs
>  CONFIGS_WORK_DIR=${REPO_ROOT}/configs/${BOARD}
>  IMAGE_WORK_DIR=${REPO_ROOT}/image/${BOARD}
>  BOOTIMG_WORK_DIR=${REPO_ROOT}/bootimg/${BOARD}
>  KERNEL_WORK_DIR=${REPO_ROOT}/kernel/${BOARD}
>
> at which point, they should be includable in Makefiles and sourceable
> from scripts, yes?
>
>  do i understand that correctly?
>
> rday
>
> --
>
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
>
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
>