From cffe20a4408e10905162b6d50916a9b255712113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 9 Mar 2010 08:10:05 +0100 Subject: [PATCH] dmake: debug/release mode, more gcc warnings --- Makefile | 2 +- tools/dmake.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 50d1bbe2f..0667a610b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS=-Wall -Wextra -pedantic -g +CXXFLAGS=-Wall -Wextra -pedantic -Wfloat-equal -Wcast-qual -Wsign-conversion -Wlogical-op -g CXX=g++ BIN=${DESTDIR}/usr/bin diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 99aca367b..394befe2f 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -94,8 +94,10 @@ static void getCppFiles(std::vector &files, const std::string &path } } -int main() +int main(int argc, char **argv) { + const bool release(argc >= 2 && std::string(argv[1]) == "--release"); + // Get files.. std::vector libfiles; getCppFiles(libfiles, "lib/"); @@ -138,8 +140,9 @@ int main() std::ofstream fout("Makefile"); - // more warnings.. -Wfloat-equal -Wcast-qual -Wsign-conversion -Wlogical-op - fout << "CXXFLAGS=-Wall -Wextra -pedantic -g\n"; + // Makefile settings.. + fout << "CXXFLAGS=-Wall -Wextra -pedantic -Wfloat-equal -Wcast-qual -Wsign-conversion -Wlogical-op "; + fout << (release ? "-O2 -DNDEBUG" : "-g") << "\n"; fout << "CXX=g++\n"; fout << "BIN=${DESTDIR}/usr/bin\n\n"; fout << "# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml\n";