build: Rename config variables

I'm giving them a CONFIG_ prefix.  I also made version.h a real file
that uses a config variable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2013-07-05 12:14:51 -04:00 committed by Anna Schumaker
parent 38c074d898
commit cf7f1f726f
5 changed files with 24 additions and 34 deletions

1
.gitignore vendored
View File

@ -8,6 +8,5 @@ ocarina.bin
.sconsign.dblite .sconsign.dblite
bin/ bin/
lib/ lib/
include/version.h
PKGBUILD PKGBUILD
!PKGBUILD.tmpl !PKGBUILD.tmpl

10
config
View File

@ -1,10 +1,10 @@
#!/usr/bin/python #!/usr/bin/python
import os import os
VERSION = 6.0 CONFIG_VERSION = 6.0
DEBUG = True CONFIG_DEBUG = True
Export("VERSION", "DEBUG") Export("CONFIG_VERSION", "CONFIG_DEBUG")
# Set up default environments # Set up default environments
@ -16,10 +16,10 @@ def get_env(flags):
return e return e
release = get_env([ "-O2" ]) release = get_env([ "-O2" ])
debug = get_env([ "-Wall", "-Werror", "-g", "-DDEBUG" ]) debug = get_env([ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ])
env = release env = release
if DEBUG == True: if CONFIG_DEBUG == True:
env = debug env = debug
Export("release", "debug", "env") Export("release", "debug", "env")

View File

@ -41,7 +41,6 @@ Files:
library.cpp library.cpp
playlist.cpp playlist.cpp
prefs.cpp prefs.cpp
print.cpp
ocarina/tests/ ocarina/tests/
$HOME/.ocarina{-debug}/ $HOME/.ocarina{-debug}/
@ -62,13 +61,13 @@ Install:
Versioning: (include/version.h> Versioning: (include/version.h)
During compile a version.h file will be created to use for printing This file contains a simple function for returning a string stating
out version information. the current version.
Printing: (print.cpp> Printing: (include/print.h>
Sometimes text needs to be printed to the screen so users (or debuggers) Sometimes text needs to be printed to the screen so users (or debuggers)
know what is going on. know what is going on.

View File

@ -1,25 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
Import("VERSION", "DEBUG") Import("CONFIG_VERSION", "release", "debug")
vers = str(VERSION) release.Append(CCFLAGS = [ "-DCONFIG_VERSION=%s" % CONFIG_VERSION ])
if DEBUG == True: debug.Append(CCFLAGS = ["-DCONFIG_VERSION=%s-debug" % CONFIG_VERSION ])
vers += "-debug"
text = [ "/*",
" * Automatically generated by include/Sconscript",
" */",
"",
"#ifndef OCARINA_VERSION_H",
"#define OCARINA_VERSION_H",
"",
"static inline const char *get_version() {",
" return \"%s\";" % vers,
"}",
"",
"#endif /* OCARINA_VERSION_H */"
]
f = open("version.h", 'w')
for line in text:
f.write("%s\n" % line)
f.close()

12
include/version.h Normal file
View File

@ -0,0 +1,12 @@
/*
* Copyright 2013 (c) Bryan Schumaker.
*/
#ifndef OCARINA_VERSION_H
#define OCARINA_VERSION_H
static inline const char *get_version()
{
return "CONFIG_VERSION";
}
#endif /* OCARINA_VERSION_H */