Differences between revisions 4 and 5
Revision 4 as of 2013-08-27 15:42:48
Size: 402
Editor: HoraceSan
Comment:
Revision 5 as of 2013-08-28 20:45:10
Size: 1202
Comment: Spam
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
I'm Melodee and I live in Mediis. <<BR>>
I'm interested in Computing and Information Science, Bird watching and Portuguese art. I like to travel and watching The Vampire Diaries.<<BR>>
<<BR>>
 http://www.publicdomainpictures.net/pictures/50000/nahled/broken-door.jpg Metoder som används för [[http://Www.spela.se/|onlinespel]] Utbetalningar<<BR>>
<<BR>>
my webpage [[http://casinno.se|casino]]
Here is a fragment that illustrates how to make Phony targets that run commands. The !AlwaysBuild line makes sure the command runs even if there happens to be a file named the same as the target.

{{{#!python
def PhonyTarget(target, action):
        phony = Environment(ENV = os.environ,
                            BUILDERS = { 'phony' : Builder(action = action) })
        AlwaysBuild(phony.phony(target = target, source = 'SConstruct'))

PhonyTarget('TAGS', 'tools/mktags.sh -e')
}}}

Here's a better implementation that handles multiple targets and doesn't require generating an Environment every time.

{{{#!python
def PhonyTargets(env = None, **kw):
    if not env: env = DefaultEnvironment()
    for target,action in kw.items():
        env.AlwaysBuild(env.Alias(target, [], action))

PhonyTargets(TAGS = 'tools/mktags.sh -e')

env = Environment(parse_flags = '-std=c89 -DFOO -lm')
PhonyTargets(env, CFLAGS = '@echo $CFLAGS',
                  DEFINES = '@echo $CPPDEFINES',
                  LIBS = '@echo $LIBS')
}}}

The output looks like this: {{{
$ scons TAGS
tools/mktags.sh -e
 ...
$ scons CFLAGS
-std=c89
$ scons DEFINES
FOO
$ scons LIBS
m
}}}

Here is a fragment that illustrates how to make Phony targets that run commands. The AlwaysBuild line makes sure the command runs even if there happens to be a file named the same as the target.

   1 def PhonyTarget(target, action):
   2         phony = Environment(ENV = os.environ,
   3                             BUILDERS = { 'phony' : Builder(action = action) })
   4         AlwaysBuild(phony.phony(target = target, source = 'SConstruct'))
   5 
   6 PhonyTarget('TAGS', 'tools/mktags.sh -e')

Here's a better implementation that handles multiple targets and doesn't require generating an Environment every time.

   1 def PhonyTargets(env = None, **kw):
   2     if not env: env = DefaultEnvironment()
   3     for target,action in kw.items():
   4         env.AlwaysBuild(env.Alias(target, [], action))
   5 
   6 PhonyTargets(TAGS = 'tools/mktags.sh -e')
   7 
   8 env = Environment(parse_flags = '-std=c89 -DFOO -lm')
   9 PhonyTargets(env, CFLAGS  = '@echo $CFLAGS',
  10                   DEFINES = '@echo $CPPDEFINES',
  11                   LIBS    = '@echo $LIBS')

The output looks like this:

$ scons TAGS
tools/mktags.sh -e
 ...
$ scons CFLAGS
-std=c89
$ scons DEFINES
FOO
$ scons LIBS
m

PhonyTargets (last edited 2013-08-28 20:45:10 by WilliamDeegan)