Skip to content
Permalink
Browse files

Merge pull request #13343 from permcody/makefile_fixes

Simplify Makefiles for modules
  • Loading branch information...
moosebuild committed May 2, 2019
2 parents b2f208e + 05bc123 commit edcff0e2aaba55a186bbea00897a0115136509c8
@@ -263,13 +263,22 @@ LIBRARY_SUFFIX :=
# Instantiate a new suffix rule for the module loader
$(eval $(call CXX_RULE_TEMPLATE,_with$(app_LIB_SUFFIX)))

ifeq ($(BUILD_EXEC),yes)
all:: $(app_EXEC)
# If this is a matching module then build the exec, otherwise fall back and use the variable
ifneq (,$(MODULE_NAME))
ifeq ($(MODULE_NAME),$(APPLICATION_NAME))
all:: $(app_EXEC)
else
all:: $(app_LIB)
endif
else
all:: $(app_LIB)
endif
ifeq ($(BUILD_EXEC),yes)
all:: $(app_EXEC)
else
all:: $(app_LIB)
endif

BUILD_EXEC :=
BUILD_EXEC :=
endif

app_GIT_DIR := $(shell cd "$(APPLICATION_DIR)" && which git &> /dev/null && git rev-parse --show-toplevel)
# Use wildcard in case the files don't exist
@@ -975,7 +975,7 @@ MooseApp::setOutputPosition(Point p)
_output_position = p;
_output_warehouse.meshChanged();

if (_executioner.get() != NULL)
if (_executioner.get())
_executioner->parentOutputPositionChanged();
}

@@ -1101,6 +1101,7 @@ MooseApp::dynamicAppRegistration(const std::string & app_name,
std::string library_path,
const std::string & library_name)
{
#ifdef LIBMESH_HAVE_DLOPEN
Parameters params;
params.set<std::string>("app_name") = app_name;
params.set<RegistrationType>("reg_type") = APPLICATION;
@@ -1127,6 +1128,9 @@ MooseApp::dynamicAppRegistration(const std::string & app_name,
"methods.";
mooseError(oss.str());
}
#else
mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
#endif
}

void
@@ -1137,6 +1141,7 @@ MooseApp::dynamicAllRegistration(const std::string & app_name,
std::string library_path,
const std::string & library_name)
{
#ifdef LIBMESH_HAVE_DLOPEN
Parameters params;
params.set<std::string>("app_name") = app_name;
params.set<RegistrationType>("reg_type") = REGALL;
@@ -1149,6 +1154,9 @@ MooseApp::dynamicAllRegistration(const std::string & app_name,
params.set<ActionFactory *>("action_factory") = action_factory;

dynamicRegistration(params);
#else
mooseError("Dynamic Loading is either not supported or was not detected by libMesh configure.");
#endif
}

void
@@ -1241,14 +1249,20 @@ MooseApp::loadLibraryAndDependencies(const std::string & library_filename,
// Assemble the actual filename using the base path of the *.la file and the dl_lib_filename
std::string dl_lib_full_path = lib_name_parts.first + '/' + dl_lib_filename;

MooseUtils::checkFileReadable(dl_lib_full_path, false, /*throw_on_unreadable=*/true);

#ifdef LIBMESH_HAVE_DLOPEN
void * handle = dlopen(dl_lib_full_path.c_str(), RTLD_LAZY);
#else
void * handle = NULL;
void * handle = nullptr;
#endif

if (!handle)
mooseError("Cannot open library: ", dl_lib_full_path.c_str(), "\n");
mooseError("The library file \"",
dl_lib_full_path,
"\" exists and has proper permissions, but cannot by dynamically loaded.\nThis "
"generally means that the loader was unable to load one or more of the "
"dependencies listed in the supplied library (see otool or ldd).\n");

// get the pointer to the method in the library. The dlsym()
// function returns a null pointer if the symbol cannot be found,
@@ -1257,7 +1271,7 @@ MooseApp::loadLibraryAndDependencies(const std::string & library_filename,
#ifdef LIBMESH_HAVE_DLOPEN
void * registration_method = dlsym(handle, registration_method_name.c_str());
#else
void * registration_method = NULL;
void * registration_method = nullptr;
#endif

if (!registration_method)
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/chemical_reactions
APPLICATION_NAME := chemical_reactions
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := chemical_reactions
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/contact
APPLICATION_NAME := contact
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := contact
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -11,18 +11,16 @@
MODULE_DIR ?= $(shell dirname `pwd`)
MOOSE_DIR ?= $(shell dirname $(MODULE_DIR))
FRAMEWORK_DIR ?= $(MOOSE_DIR)/framework
ADDITIONAL_CPPFLAGS += -Wall -Wextra
###############################################################################

# framework
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/external_petsc_solver
APPLICATION_NAME := external_petsc_solver
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := external_petsc_solver
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_NAME := fluid_properties
APPLICATION_DIR := $(MODULE_DIR)/$(APPLICATION_NAME)
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := fluid_properties
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_NAME := functional_expansion_tools
APPLICATION_DIR := $(MODULE_DIR)/$(APPLICATION_NAME)
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := functional_expansion_tools
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/heat_conduction
APPLICATION_NAME := heat_conduction
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := heat_conduction
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/level_set
APPLICATION_NAME := level_set
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := level_set
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/misc
APPLICATION_NAME := misc
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := misc
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
@@ -1,10 +1,23 @@
###############################################################################
############################ COMMON MODULES ###################################
###############################################################################
################################################################################
############################ COMMON MODULES ####################################
################################################################################

# When building an individual module, you should define MODULE_NAME (lower case)
# to the module you want to build before including this file. When doing that,
# there is no need to duplicate the dependencies in the individual module's
# Makefile.

ifneq (,$(MODULE_NAME))
# Exec will automatically be built for the given MODULE_NAME
SKIP_LOADER := yes
UC_APP = $(shell echo $(MODULE_NAME) | tr a-z A-Z)
$(eval $(UC_APP):=yes)
endif

ifeq ($(ALL_MODULES),yes)
CHEMICAL_REACTIONS := yes
CONTACT := yes
EXTERNAL_PETSC_SOLVER := yes
FLUID_PROPERTIES := yes
FUNCTIONAL_EXPANSION_TOOLS := yes
HEAT_CONDUCTION := yes
@@ -19,7 +32,6 @@ ifeq ($(ALL_MODULES),yes)
STOCHASTIC_TOOLS := yes
TENSOR_MECHANICS := yes
XFEM := yes
EXTERNAL_PETSC_SOLVER := yes
endif

ifeq ($(XFEM),yes)
@@ -50,9 +62,9 @@ endif
# The master list of all moose modules
MODULE_NAMES := "chemical_reactions contact fluid_properties functional_expansion_tools heat_conduction level_set misc navier_stokes phase_field porous_flow rdg richards solid_mechanics stochastic_tools tensor_mechanics xfem external_petsc_solver"

###############################################################################
########################## MODULE REGISTRATION ################################
###############################################################################
################################################################################
########################## MODULE REGISTRATION #################################
################################################################################
GEN_REVISION := no

ifeq ($(CHEMICAL_REACTIONS),yes)
@@ -104,6 +116,13 @@ ifeq ($(MISC),yes)
include $(FRAMEWORK_DIR)/app.mk
endif

ifeq ($(RDG),yes)
APPLICATION_DIR := $(MOOSE_DIR)/modules/rdg
APPLICATION_NAME := rdg
SUFFIX := rdg
include $(FRAMEWORK_DIR)/app.mk
endif

ifeq ($(NAVIER_STOKES),yes)
APPLICATION_DIR := $(MOOSE_DIR)/modules/navier_stokes
APPLICATION_NAME := navier_stokes
@@ -141,13 +160,6 @@ ifeq ($(POROUS_FLOW),yes)
include $(FRAMEWORK_DIR)/app.mk
endif

ifeq ($(RDG),yes)
APPLICATION_DIR := $(MOOSE_DIR)/modules/rdg
APPLICATION_NAME := rdg
SUFFIX := rdg
include $(FRAMEWORK_DIR)/app.mk
endif

ifeq ($(RICHARDS),yes)
APPLICATION_DIR := $(MOOSE_DIR)/modules/richards
APPLICATION_NAME := richards
@@ -18,17 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

FLUID_PROPERTIES := yes
HEAT_CONDUCTION := yes
SKIP_LOADER := yes
# Module
MODULE_NAME := navier_stokes
include $(MODULE_DIR)/modules.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/navier_stokes
APPLICATION_NAME := navier_stokes
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,17 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dependency on tensor_mechanics
TENSOR_MECHANICS := yes
SKIP_LOADER := yes
# Module
MODULE_NAME := phase_field
include $(MODULE_DIR)/modules.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/phase_field
APPLICATION_NAME := phase_field
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,20 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dependency on tensor_mechanics and fluid_properties and chemical_reactions and RDG
TENSOR_MECHANICS := yes
FLUID_PROPERTIES := yes
CHEMICAL_REACTIONS := yes
RDG := yes
SKIP_LOADER := yes
# Module
MODULE_NAME := porous_flow
include $(MODULE_DIR)/modules.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/porous_flow
APPLICATION_NAME := porous_flow
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk

###############################################################################
# Additional special case targets should be added here
@@ -18,12 +18,9 @@ ADDITIONAL_CPPFLAGS += -Wall -Wextra
include $(FRAMEWORK_DIR)/build.mk
include $(FRAMEWORK_DIR)/moose.mk

# dep apps
APPLICATION_DIR := $(MODULE_DIR)/rdg
APPLICATION_NAME := rdg
BUILD_EXEC := yes
GEN_REVISION := no
include $(FRAMEWORK_DIR)/app.mk
# Module
MODULE_NAME := rdg
include $(MODULE_DIR)/modules.mk

###############################################################################
# Additional special case targets should be added here
Oops, something went wrong.

0 comments on commit edcff0e

Please sign in to comment.
You can’t perform that action at this time.