diff --git a/.gitignore b/.gitignore index 93fba52f..815bcf8a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,5 @@ ocarina.bin .sconsign.dblite bin/ lib/ -include/version.h PKGBUILD !PKGBUILD.tmpl diff --git a/config b/config index 292e4cb9..9ae702d8 100644 --- a/config +++ b/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") diff --git a/design.txt b/design.txt index 69b59eab..46d2b3e6 100644 --- a/design.txt +++ b/design.txt @@ -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. diff --git a/include/Sconscript b/include/Sconscript index d06487c8..7e3c3828 100644 --- a/include/Sconscript +++ b/include/Sconscript @@ -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 ]) diff --git a/include/version.h b/include/version.h new file mode 100644 index 00000000..c4f10938 --- /dev/null +++ b/include/version.h @@ -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 */