help-make
[Top][All Lists]
Advanced

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

pseudo-code for a recursive multi-arch build


From: Robert P. J. Day
Subject: pseudo-code for a recursive multi-arch build
Date: Sun, 20 Jun 2004 15:59:32 -0400 (EDT)


(apologies for people who've seen enough of this, but i think i figured out what paul was talking about, and just wanted to confirm it.)

based on paul's paper on multi-arch builds, if i want to add recursion to the mix, here's what i'm thinking. in any makefile, before you kick in to processing the targets, you'll need to know a few things.

  SUBDIRS =
  LOCAL_TARGETS =
  SUB_TARGETS =

obviously, in any makefile, SUBDIRS represents the immediate subdirectories which you might have to enter.

in addition, LOCAL_TARGETS and SUB_TARGETS represent, respectively, those targets that can be built *immediately* at this make level using the advanced VPATH technique, and those targets that should be recursively processed by entering the subdirectories. (it's possible that the same target could be on both lists -- for example, the target "clean" could involve cleaning up stuff both in the immediate directory and in subdirectories.)

so, in pseudo-code, it seems that a makefile at any level would look like (i use BUILD_DIR rather than paul's choice of OBJDIR):

  if (in source directory) ; then
    if there are even any selected LOCAL_TARGETS to build ; then
      cd ${BUILD_DIR} ; use VPATH to build (selected) LOCAL_TARGETS only
    endif
    recursively enter SUBDIRS to build (selected) SUB_TARGETS
  else
    VPATH = ${SRCDIR}
    build (selected) LOCAL_TARGETS only
  endif

i'm not sure that this can be made much simpler. obviously, each makefile has to have its own list of SUBDIRS. also, for all of the potential targets, each makefile needs to know those targets that can be built entirely locally (thusly by VPATH), and those that require recursive processing within the SUBDIRS.

(it's possible that, if the source tree is several levels deep, the make process might need to go several levels down before ever getting to its first "local" build. this just means that whatever the initial BUILD_DIR location was for the top level make, each makefile would be responsible for creating its corresponding build directory somewhere beneath that.)

  if i haven't made any egregious errors, i'll code this up and see how
well it works.

rday

p.s. it goes without saying that the "local" builds have to be completely buildable using the VPATH technique. this seems to disqualify any targets whose rules invoke any local programs or scripts, the way the linux kernel does by running something like "scripts/config".

while that might work just fine if you're in the source directory, it makes a mess of running such a rule from the build directory, unless there's something obvious i'm missing.





reply via email to

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