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:
parent
38c074d898
commit
cf7f1f726f
|
@ -8,6 +8,5 @@ ocarina.bin
|
|||
.sconsign.dblite
|
||||
bin/
|
||||
lib/
|
||||
include/version.h
|
||||
PKGBUILD
|
||||
!PKGBUILD.tmpl
|
||||
|
|
10
config
10
config
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/python
|
||||
import os
|
||||
|
||||
VERSION = 6.0
|
||||
DEBUG = True
|
||||
CONFIG_VERSION = 6.0
|
||||
CONFIG_DEBUG = True
|
||||
|
||||
Export("VERSION", "DEBUG")
|
||||
Export("CONFIG_VERSION", "CONFIG_DEBUG")
|
||||
|
||||
|
||||
# Set up default environments
|
||||
|
@ -16,10 +16,10 @@ def get_env(flags):
|
|||
return e
|
||||
|
||||
release = get_env([ "-O2" ])
|
||||
debug = get_env([ "-Wall", "-Werror", "-g", "-DDEBUG" ])
|
||||
debug = get_env([ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ])
|
||||
|
||||
env = release
|
||||
if DEBUG == True:
|
||||
if CONFIG_DEBUG == True:
|
||||
env = debug
|
||||
Export("release", "debug", "env")
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ Files:
|
|||
library.cpp
|
||||
playlist.cpp
|
||||
prefs.cpp
|
||||
print.cpp
|
||||
ocarina/tests/
|
||||
|
||||
$HOME/.ocarina{-debug}/
|
||||
|
@ -62,13 +61,13 @@ Install:
|
|||
|
||||
|
||||
|
||||
Versioning: (include/version.h>
|
||||
During compile a version.h file will be created to use for printing
|
||||
out version information.
|
||||
Versioning: (include/version.h)
|
||||
This file contains a simple function for returning a string stating
|
||||
the current version.
|
||||
|
||||
|
||||
|
||||
Printing: (print.cpp>
|
||||
Printing: (include/print.h>
|
||||
Sometimes text needs to be printed to the screen so users (or debuggers)
|
||||
know what is going on.
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
#!/usr/bin/python
|
||||
Import("VERSION", "DEBUG")
|
||||
Import("CONFIG_VERSION", "release", "debug")
|
||||
|
||||
vers = str(VERSION)
|
||||
if DEBUG == True:
|
||||
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()
|
||||
release.Append(CCFLAGS = [ "-DCONFIG_VERSION=%s" % CONFIG_VERSION ])
|
||||
debug.Append(CCFLAGS = ["-DCONFIG_VERSION=%s-debug" % CONFIG_VERSION ])
|
||||
|
|
|
@ -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 */
|
Loading…
Reference in New Issue