help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Robert P. J. Day
Subject: more style: sharing variable setting include/source files with scripts
Date: Thu, 31 Oct 2019 11:23:40 -0400 (EDT)
User-agent: Alpine 2.21 (LFD 202 2017-01-01)

  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 via email to

[Prev in Thread] Current Thread [Next in Thread]