From 939144233c48edb596344f92926fa1aaa3e78610 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 3 Apr 2019 08:57:01 +0200 Subject: [PATCH] STYLE: adjusted wording and messages for wmake - add an additional test for wmake pre-processing --- applications/test/wmake1/Make/files | 10 +++++ applications/test/wmake1/Make/options | 2 + applications/test/wmake1/Test-wmake1.C | 56 ++++++++++++++++++++++++++ applications/test/wmake1/newStub.C | 13 ++++++ applications/test/wmake1/oldStub.C | 17 ++++++++ wmake/makefiles/general | 2 +- wmake/makefiles/info | 5 +-- wmake/wmake | 18 ++++----- 8 files changed, 108 insertions(+), 15 deletions(-) create mode 100644 applications/test/wmake1/Make/files create mode 100644 applications/test/wmake1/Make/options create mode 100644 applications/test/wmake1/Test-wmake1.C create mode 100644 applications/test/wmake1/newStub.C create mode 100644 applications/test/wmake1/oldStub.C diff --git a/applications/test/wmake1/Make/files b/applications/test/wmake1/Make/files new file mode 100644 index 0000000000..3ef1ed76a9 --- /dev/null +++ b/applications/test/wmake1/Make/files @@ -0,0 +1,10 @@ +Test-wmake1.C + +/* #if OPENFOAM == 1812 */ +#if OPENFOAM > 1812 +newStub.C +#else +oldStub.C +#endif + +EXE = $(FOAM_APPBIN)/Test-wmake1 diff --git a/applications/test/wmake1/Make/options b/applications/test/wmake1/Make/options new file mode 100644 index 0000000000..75c7356f1c --- /dev/null +++ b/applications/test/wmake1/Make/options @@ -0,0 +1,2 @@ +EXE_INC = +EXE_LIBS = diff --git a/applications/test/wmake1/Test-wmake1.C b/applications/test/wmake1/Test-wmake1.C new file mode 100644 index 0000000000..614d9189fb --- /dev/null +++ b/applications/test/wmake1/Test-wmake1.C @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + Test-wmake1 + +Description + Some tests for wmake features. + For example, testing how robust or fragile version-dependent conditional + compilation works. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" + +namespace Foam +{ + void printTest(); +} + + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + printTest(); + + Info<< "\nEnd\n" << nl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/wmake1/newStub.C b/applications/test/wmake1/newStub.C new file mode 100644 index 0000000000..153ccd4173 --- /dev/null +++ b/applications/test/wmake1/newStub.C @@ -0,0 +1,13 @@ +// Some test code + +#include "foamVersion.H" +#include "IOstreams.H" + +namespace Foam +{ + void printTest() + { + Info<< nl; + foamVersion::printBuildInfo(); + } +} diff --git a/applications/test/wmake1/oldStub.C b/applications/test/wmake1/oldStub.C new file mode 100644 index 0000000000..136b7d8086 --- /dev/null +++ b/applications/test/wmake1/oldStub.C @@ -0,0 +1,17 @@ +// Some test code + +#include "IOstreams.H" + +namespace Foam +{ + void printTest() + { + Info<< nl << "Using old stub" << nl; + + #if OPENFOAM + Info<< "OPENFOAM=" << OPENFOAM << nl; + #else + Info<< "OPENFOAM is undefined" << nl; + #endif + } +} diff --git a/wmake/makefiles/general b/wmake/makefiles/general index 198e5c1e59..2177e89a87 100644 --- a/wmake/makefiles/general +++ b/wmake/makefiles/general @@ -175,7 +175,7 @@ lib: $(LIB).a | silent $(LIB).a: $(OBJECTS) @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f $(LIB).a - $(call QUIET_MESSAGE,ar,$(LIB)) + $(call QUIET_MESSAGE,ar,$(LIB).a) $E $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS) $(call QUIET_MESSAGE,ranlib,$(notdir $(LIB))) $E $(RANLIB) $(LIB).a diff --git a/wmake/makefiles/info b/wmake/makefiles/info index 90fa2b550d..600399a173 100644 --- a/wmake/makefiles/info +++ b/wmake/makefiles/info @@ -43,16 +43,13 @@ include $(GENERAL_RULES)/general # Display information #------------------------------------------------------------------------------ -export WM_VERSION - - .PHONY: compile compile: @echo "$(strip $(CC) $(c++FLAGS))" .PHONY: api api: - @echo "$${WM_VERSION#*=}" + @echo "$(WM_VERSION)" | sed -e 's/^.*=//' .PHONY: c c: diff --git a/wmake/wmake b/wmake/wmake index 7591fc9451..97f135a737 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -70,18 +70,16 @@ options: -s | -silent Quiet mode (does not echo commands) -a | -all wmake all sub-directories, running Allwmake if present -q | -queue wmakeCollect all sub-directories, running Allwmake if present - -k | -keep-going Keep going without stopping when errors occur (-non-stop) + -k | -keep-going Keep going even when errors occur (-non-stop) -j Compile using all local cores/hyperthreads - -jN or -j N Compile using N cores/hyperthreads + -jN | -j N Compile using N cores/hyperthreads -no-scheduler Disable scheduled parallel compilation - -pwd Print root directory containing a Make/ directory and exit - -update Update lnInclude directories, dep files, remove deprecated - files and directories - -show Identical to -show-compile - -show-api Print api value and exit - -show-compile Print C++ compiler value/flags and exit - -show-cxx Print C++ compiler value and exit - -show-cxxflags Print C++ compiler flags and exit + -pwd Print root directory containing a Make/ directory + -update Update lnInclude dirs, dep files, remove deprecated files/dirs + -show-api Print api value + -show-compile Print C++ compiler value and flags (shortcut: -show) + -show-cxx Print C++ compiler value + -show-cxxflags Print C++ compiler flags -h | -help Print the usage