2010-05-12 13:27:55 +00:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# ========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
# \\ / F ield | foam-extend: Open Source CFD
|
2018-05-29 07:35:20 +00:00
|
|
|
# \\ / O peration | Version: 4.1
|
2015-05-17 13:32:07 +00:00
|
|
|
# \\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
# \\/ M anipulation | For copyright notice see file Copyright
|
2010-05-12 13:27:55 +00:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# License
|
2013-12-11 16:09:41 +00:00
|
|
|
# This file is part of foam-extend.
|
2010-05-12 13:27:55 +00:00
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend is free software: you can redistribute it and/or modify it
|
2010-05-12 13:27:55 +00:00
|
|
|
# under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
# Free Software Foundation, either version 3 of the License, or (at your
|
2010-05-12 13:27:55 +00:00
|
|
|
# option) any later version.
|
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend 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.
|
2010-05-12 13:27:55 +00:00
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-12 13:27:55 +00:00
|
|
|
#
|
|
|
|
# Script
|
|
|
|
# Makefile
|
|
|
|
#
|
|
|
|
# Description
|
|
|
|
# Generic Makefile used by wmake
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
2010-08-24 15:19:39 +00:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# The Makefile use a POSIX shell
|
2010-05-12 13:27:55 +00:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
SHELL = /bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Initialise suffices list
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
.SUFFIXES: .o
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Set the directory containing the wmake scripts
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
WM_SCRIPTS = $(WM_DIR)/scripts
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# declare default paths
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
LIB_SRC = $(WM_PROJECT_DIR)/src
|
|
|
|
LIB_DIR = $(WM_PROJECT_DIR)/lib
|
2010-12-27 11:50:58 +00:00
|
|
|
LIB_WM_OPTIONS_DIR = $(LIB_DIR)/$(WM_OPTIONS)
|
2010-05-12 13:27:55 +00:00
|
|
|
OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
|
|
|
|
CLASSES_DIR = $(MAKE_DIR)/classes
|
|
|
|
|
|
|
|
SYS_INC =
|
|
|
|
SYS_LIBS =
|
|
|
|
|
2016-06-03 16:13:21 +00:00
|
|
|
ifeq ($(WM_ARCH_BASE),mingw)
|
|
|
|
PROJECT_INC = -I$(FOAM_SRC) -I$(FOAM_APP) -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
|
|
|
|
else
|
2010-08-24 15:19:39 +00:00
|
|
|
PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
|
2016-06-03 16:13:21 +00:00
|
|
|
endif
|
2010-05-12 13:27:55 +00:00
|
|
|
PROJECT_LIBS = -l$(WM_PROJECT)
|
|
|
|
PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g'))
|
|
|
|
|
|
|
|
EXE_INC =
|
|
|
|
EXE_LIBS =
|
|
|
|
|
|
|
|
LIB_LIBS =
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# declare all .o files depend on $(OBJECTS_DIR)/options
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
EXE_DEP = $(OBJECTS_DIR)/options
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# declare default name of libraries and executables
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# Library
|
|
|
|
LIB = libNULL
|
|
|
|
|
|
|
|
# Shared library extension
|
2010-10-03 11:33:52 +00:00
|
|
|
ifeq ($(WM_ARCH_BASE),darwin)
|
2010-05-12 13:27:55 +00:00
|
|
|
# Using Mac OSX
|
|
|
|
SO = dylib
|
2015-08-04 12:39:06 +00:00
|
|
|
else ifeq ($(WM_ARCH_BASE),mingw)
|
|
|
|
# Using MinGW-w64 compiler on Windows
|
|
|
|
SO = dll
|
2010-05-12 13:27:55 +00:00
|
|
|
else
|
|
|
|
SO = so
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Project executable
|
|
|
|
EXE = $(WM_PROJECT).out
|
|
|
|
|
|
|
|
# Standalone executable
|
|
|
|
SEXE = a.out
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# set compilation and dependency building rules
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
GENERAL_RULES = $(WM_DIR)/rules/General
|
|
|
|
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
|
2010-08-24 15:19:39 +00:00
|
|
|
BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER)
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
include $(GENERAL_RULES)/general
|
|
|
|
include $(RULES)/general
|
|
|
|
include $(RULES)/$(WM_LINK_LANGUAGE)
|
|
|
|
|
|
|
|
MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $<
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Include PROJECT directory tree file and
|
|
|
|
# source, object and dependency list files.
|
|
|
|
# These are constructed by wmakeDerivedFiles
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
include $(OBJECTS_DIR)/options
|
|
|
|
include $(OBJECTS_DIR)/filesMacros
|
|
|
|
include $(OBJECTS_DIR)/sourceFiles
|
|
|
|
include $(OBJECTS_DIR)/objectFiles
|
|
|
|
include $(OBJECTS_DIR)/localObjectFiles
|
|
|
|
include $(OBJECTS_DIR)/dependencyFiles
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# set header file include paths
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
LIB_HEADER_DIRS = \
|
|
|
|
$(EXE_INC) \
|
|
|
|
-IlnInclude \
|
|
|
|
-I. \
|
|
|
|
$(PROJECT_INC) \
|
|
|
|
$(GINC) \
|
|
|
|
$(SYS_INC)
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# define link statements for executables
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
$(EXE): $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(EXE)
|
|
|
|
$(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \
|
|
|
|
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
|
|
|
|
|
|
|
|
exe: $(SEXE)
|
|
|
|
@echo \'$(SEXE)\' is up to date.
|
|
|
|
|
|
|
|
$(SEXE): $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(SEXE)
|
|
|
|
$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
|
|
|
|
$(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# define link statements for libraries
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2015-08-04 12:39:06 +00:00
|
|
|
ifneq (,$(findstring libfoam,$(LIB)))
|
|
|
|
EXTRA_LIBS=
|
|
|
|
else
|
|
|
|
EXTRA_LIBS=-lfoam
|
|
|
|
endif
|
|
|
|
|
2010-05-12 13:27:55 +00:00
|
|
|
libso: $(LIB).$(SO)
|
|
|
|
@echo \'$(LIB).$(SO)\' is up to date.
|
|
|
|
|
|
|
|
$(LIB).$(SO): $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(LIB)
|
|
|
|
@rm -f so_locations
|
2010-10-02 20:52:03 +00:00
|
|
|
ifeq ($(WM_ARCH_BASE),darwin)
|
|
|
|
@cd $(OBJECTS_DIR) ; \
|
2015-10-22 16:25:49 +00:00
|
|
|
$(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -install_name $(LIB).$(SO) -o $(LIB).$(SO)
|
2015-08-04 12:39:06 +00:00
|
|
|
else ifeq ($(WM_ARCH_BASE),mingw)
|
|
|
|
@cd $(OBJECTS_DIR) ; \
|
|
|
|
$(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) $(EXTRA_LIBS) -o $(LIB).$(SO) -Wl,--out-implib,$(LIB).a
|
2010-10-02 20:52:03 +00:00
|
|
|
else
|
2010-05-12 13:27:55 +00:00
|
|
|
@cd $(OBJECTS_DIR) ; \
|
|
|
|
$(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
|
2010-10-02 20:52:03 +00:00
|
|
|
endif
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
lib: $(LIB).a
|
|
|
|
@echo \'$(LIB).a\' is up to date.
|
|
|
|
|
|
|
|
$(LIB).a: $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(LIB)
|
|
|
|
@rm -f $(LIB).a
|
|
|
|
$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
|
|
|
|
$(RANLIB) $(LIB).a
|
|
|
|
|
|
|
|
libo: $(LIB).o
|
|
|
|
@echo \'$(LIB).o\' is up to date.
|
|
|
|
|
|
|
|
$(LIB).o: $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(LIB)
|
|
|
|
@rm -f $(LIB).o
|
|
|
|
$(LD) -r -o $(LIB).o $(OBJECTS)
|
|
|
|
|
|
|
|
jar: $(LIB).jar
|
|
|
|
@echo \'$(LIB).jar\' is up to date.
|
|
|
|
|
|
|
|
$(LIB).jar: $(OBJECTS)
|
|
|
|
@$(WM_SCRIPTS)/mkObjectDir $(LIB)
|
|
|
|
jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) .
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Set rule to create the include directory for libraries
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options
|
2010-08-24 15:19:39 +00:00
|
|
|
@rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Set depedency rule and include dependency lists
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
$(OBJECTS_DIR)/dependencies: $(DEPENDENCIES)
|
|
|
|
@echo dependencies up to date > $(OBJECTS_DIR)/dependencies
|
|
|
|
|
|
|
|
include $(INCLUDE_DEPS)
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|