[Top][All Lists]

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

tweaking compilation options recursively

From: Robert P. J. Day
Subject: tweaking compilation options recursively
Date: Fri, 11 Mar 2005 17:03:12 -0500 (EST)

  ok, this is what i was after, and i'm interested in any feedback
(short of hideous gagging sounds):

# bb_CFLAGS_absolute = -cant -touch -this
bb_CFLAGS = -c -d -e -f
bb_CFLAGS_prepend = -a
bb_CFLAGS_append = -x -y
bb_CFLAGS_remove = -x -d -z -b

define fixvar
 $(if ${$1_$2_absolute},\
  $(filter-out \
   ${$1_$2_prepend} ${$1_$2} ${$1_$2_append}\

.PHONY: t1
        @echo bb CFLAGS will be $(call fixvar,bb,CFLAGS)


  the rationale:  imagine a large software structure containing
numerous components including, say, busybox (bb).  now, there's going
to be a top-level file of some sort, in which all of the
compile/preprocess options will be set, so that file will contain,

  bb_CFLAGS = -cf1 -cf2 -cf3
  bb_INCLUDES = ...
  bb_LDLIBS = ... (you get the idea)

and the makefile for busybox would normally then do the compile with


*however*, i need the freedom to, after i include that top-level file,
tweak arbitrary sets of options without hunting thru the entire
structure for the relevant subdirectory.  for any option for any
software component, i might want to:

  1) prepend an option or two
  2) append an option or three
  3) remove the occasional option or four

so i invented the above "fixvar" macro which does exactly that.

  is this overly obtuse?  it does give me the freedom to, from the
top-level invocation, slightly adjust any option for any software
component anywhere in the entire build.



reply via email to

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