build: Don't generate include/version.h all the time
Installing, cleaning and archiving don't need to create the version.h file, so instead I'll add it as a build step for ocarina.
This commit is contained in:
parent
863bce3482
commit
41f1c01752
|
@ -22,7 +22,7 @@ env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
|
|||
env.ParseConfig('pkg-config --cflags --libs gstreamer-0.10')
|
||||
env.ParseConfig('pkg-config --cflags --libs taglib')
|
||||
|
||||
def version_h():
|
||||
def version_h(target, source, env):
|
||||
f = open("include/version.h", "w")
|
||||
for line in open("include/version.tmpl", "r"):
|
||||
line = line.replace("__MAJOR__", str(MAJOR))
|
||||
|
@ -31,13 +31,15 @@ def version_h():
|
|||
line = line.replace("__EXTRA__", str(EXTRA))
|
||||
f.write(line)
|
||||
f.close()
|
||||
version_h()
|
||||
|
||||
def list_dirs(directory):
|
||||
import os
|
||||
dirs = [x[0] for x in os.walk(directory)]
|
||||
return [Glob(dir + "/*.cpp") for dir in dirs]
|
||||
|
||||
# Note: a version.h file is not created in this directory,
|
||||
# so the command will always run.
|
||||
Default( env.Command("version.h", None, version_h) )
|
||||
ocarina=env.Program('ocarina.bin', list_dirs('libsaria') + list_dirs('ocarina'))
|
||||
Default(ocarina)
|
||||
|
||||
|
|
Loading…
Reference in New Issue