Commit 52cf2d68 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: avoid 'sed -i' in wmake rules

- less efficient and less portable than using single-pass processing
parent a9741cea
......@@ -6,20 +6,8 @@
# \\/ 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 <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# wmake/makefiles/apps
......
......@@ -3,23 +3,11 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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 <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# wmake/makefiles/files
......@@ -56,20 +44,19 @@ all : $(OPTIONS) $(SFILES) $(VARS)
$(OPTIONS) : $(MAKE_DIR)/options
@$(CPP) $(GFLAGS) $(MAKE_DIR)/options | sed -e 's@ *@ @g' > $(OPTIONS)
$(SFILES): $(MAKE_DIR)/files
@$(CPP) $(GFLAGS) $(MAKE_DIR)/files | sed -e 's@ *@ @g' > $(FILES)
# Find all macro definitions in the files
@grep "=" $(FILES) > $(VARS)
echo "SOURCE = " > $(SFILES)
# Remove all macro definitions from the files list
@grep -v "=" $(FILES) >> $(SFILES)
# Extracted macro definitions.
@sed -n -e '/=/p' $(FILES) > $(VARS)
@echo "SOURCE = \\" > $(SFILES)
# Remove macros, comments, blank lines, trailing space. Add backslash continuation
@sed -e '/=/d; /^#/d; /^[ \t]*$$/d' -e 's@[ \t]*$$@ \\@' $(FILES) >> $(SFILES)
@rm -f $(FILES)
# Add a newline to files to ensure the last line is followed by a newline
# Ensure final line is followed by newline. Extra comment for safety.
@echo "" >> $(SFILES)
# Remove commented lines, blank lines, and trailing blanks from files
@sed -i -e '/^#/ d' -e '/^[ \t]*$$/ d' -e 's,[ \t]*$$,,' $(SFILES)
# Add backslashes
@sed -i -e 's,$$, \\,' -e '$$s,\\,,' $(SFILES)
@echo "# sources" >> $(SFILES)
$(VARS): $(SFILES)
......
......@@ -6,20 +6,8 @@
# \\/ 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 <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# wmake/makefiles/general
......@@ -30,11 +18,15 @@
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# The Makefile uses a POSIX shell
# Use POSIX shell. Default to POSIX for the OS.
#------------------------------------------------------------------------------
SHELL = /bin/sh
ifeq ("$(WM_OSTYPE)","")
WM_OSTYPE = POSIX
endif
#------------------------------------------------------------------------------
# Unset suffices list (suffix rules are not used)
......@@ -61,14 +53,14 @@ OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
SYS_INC =
SYS_LIBS =
PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude \
-I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
PROJECT_INC = \
-I$(LIB_SRC)/$(WM_PROJECT)/lnInclude \
-I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
PROJECT_LIBS = -l$(WM_PROJECT)
EXE_INC =
EXE_LIBS =
LIB_LIBS =
......@@ -80,7 +72,11 @@ LIB_LIBS =
LIB = libNULL
# Shared library extension
ifneq (,$(findstring darwin,$(WM_ARCH)))
SO = dylib
else
SO = so
endif
# Project executable
EXE = $(WM_PROJECT).out
......@@ -116,12 +112,12 @@ OBJECTS=$(BASENAMES:%=$(OBJECTS_DIR)/%.o)
#------------------------------------------------------------------------------
LIB_HEADER_DIRS = \
$(EXE_INC) \
-IlnInclude \
-I. \
$(PROJECT_INC) \
$(GINC) \
$(SYS_INC)
$(EXE_INC) \
-IlnInclude \
-I. \
$(PROJECT_INC) \
$(GINC) \
$(SYS_INC)
#------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment