mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add handling of lib/exe file extensions in makefile (#1238)
- relocates some logic from makefiles/general into platform-specific overrides
This commit is contained in:
committed by
Andrew Heather
parent
5f527c28aa
commit
d2eb50832c
@ -24,6 +24,6 @@ LIB_LIBS = \
|
|||||||
-lscotch
|
-lscotch
|
||||||
|
|
||||||
/* May require librt, but scotch does not declare the dependency */
|
/* May require librt, but scotch does not declare the dependency */
|
||||||
ifeq ("$(SO)","so")
|
ifeq ("$(EXT_SO)", ".so")
|
||||||
LIB_LIBS += -lrt
|
LIB_LIBS += -lrt
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -7,6 +7,6 @@ LIB_LIBS = \
|
|||||||
-lscotch -lscotcherrexit
|
-lscotch -lscotcherrexit
|
||||||
|
|
||||||
/* May require librt, but scotch does not declare the dependency */
|
/* May require librt, but scotch does not declare the dependency */
|
||||||
ifeq ("$(SO)","so")
|
ifeq ("$(EXT_SO)", ".so")
|
||||||
LIB_LIBS += -lrt
|
LIB_LIBS += -lrt
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd |
|
# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# | Copyright (C) 2011-2016 OpenFOAM Foundation
|
# | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -70,21 +70,23 @@ LIB_LIBS =
|
|||||||
# Declare default name of libraries and executables
|
# Declare default name of libraries and executables
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Library
|
# Shared library extension (with '.' separator)
|
||||||
LIB = libNULL
|
EXT_SO = .so
|
||||||
|
|
||||||
# Shared library extension
|
# Executable extension (with '.' separator)
|
||||||
ifneq (,$(findstring darwin,$(WM_ARCH)))
|
EXE_EXT =
|
||||||
SO = dylib
|
|
||||||
else
|
|
||||||
SO = so
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Project executable
|
# Library (default which is to be overridden)
|
||||||
EXE = $(WM_PROJECT).out
|
LIB = libNULL
|
||||||
|
|
||||||
# Standalone executable
|
# Project executable (default which is to be overridden)
|
||||||
SEXE = a.out
|
EXE = $(WM_PROJECT).out
|
||||||
|
|
||||||
|
# Standalone executable (default which is to be overridden)
|
||||||
|
SEXE = a.out
|
||||||
|
|
||||||
|
#DEBUG $(info "EXE_SO = ${EXE_SO}")
|
||||||
|
#DEBUG $(info "EXE_EXT = ${EXE_EXT}")
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -127,28 +129,28 @@ LIB_HEADER_DIRS = \
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(EXE)
|
all: $(EXE)$(EXE_EXT)
|
||||||
@:
|
@:
|
||||||
|
|
||||||
.PHONY: silent
|
.PHONY: silent
|
||||||
silent:
|
silent:
|
||||||
@:
|
@:
|
||||||
|
|
||||||
$(EXE): $(OBJECTS)
|
$(EXE)$(EXE_EXT): $(OBJECTS)
|
||||||
@$(WM_SCRIPTS)/makeTargetDir $(EXE)
|
@$(WM_SCRIPTS)/makeTargetDir $(EXE)
|
||||||
$(call QUIET_MESSAGE,ld,$(EXE))
|
$(call QUIET_MESSAGE,ld,$(EXE)$(EXE_EXT))
|
||||||
$E $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
|
$E $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
|
||||||
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
|
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
|
||||||
$(LINK_LIBS) $(GLIBS) -o $(EXE)
|
$(LINK_LIBS) $(GLIBS) -o $(EXE)$(EXE_EXT)
|
||||||
|
|
||||||
.PHONY: exe
|
.PHONY: exe
|
||||||
exe: $(SEXE) | silent
|
exe: $(SEXE)$(EXE_EXT) | silent
|
||||||
|
|
||||||
$(SEXE): $(OBJECTS)
|
$(SEXE)$(EXE_EXT): $(OBJECTS)
|
||||||
@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
|
@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
|
||||||
$(call QUIET_MESSAGE,ld,$(SEXE))
|
$(call QUIET_MESSAGE,ld,$(SEXE)$(EXE_EXT))
|
||||||
$E $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
|
$E $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
|
||||||
$(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
|
$(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)$(EXE_EXT)
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -159,13 +161,13 @@ $(SEXE): $(OBJECTS)
|
|||||||
objects: $(OBJECTS) | silent
|
objects: $(OBJECTS) | silent
|
||||||
|
|
||||||
.PHONY: libso
|
.PHONY: libso
|
||||||
libso: $(LIB).$(SO) | silent
|
libso: $(LIB)$(EXT_SO) | silent
|
||||||
|
|
||||||
$(LIB).$(SO): $(OBJECTS)
|
$(LIB)$(EXT_SO): $(OBJECTS)
|
||||||
@$(WM_SCRIPTS)/makeTargetDir $(LIB)
|
@$(WM_SCRIPTS)/makeTargetDir $(LIB)
|
||||||
$(call QUIET_MESSAGE,ld,$(LIB).$(SO))
|
$(call QUIET_MESSAGE,ld,$(LIB)$(EXT_SO))
|
||||||
$E $(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
|
$E $(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
|
||||||
$(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
|
$(LIB_LIBS) $(GLIB_LIBS) -o $(LIB)$(EXT_SO)
|
||||||
|
|
||||||
.PHONY: lib
|
.PHONY: lib
|
||||||
lib: $(LIB).a | silent
|
lib: $(LIB).a | silent
|
||||||
|
|||||||
@ -31,5 +31,4 @@ sinclude $(RULES)/general
|
|||||||
sinclude $(RULES)/c++
|
sinclude $(RULES)/c++
|
||||||
include $(GENERAL_RULES)/transform
|
include $(GENERAL_RULES)/transform
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -7,3 +7,8 @@ include $(GENERAL_RULES)/Clang/openmp
|
|||||||
|
|
||||||
include $(DEFAULT_RULES)/c
|
include $(DEFAULT_RULES)/c
|
||||||
include $(DEFAULT_RULES)/c++
|
include $(DEFAULT_RULES)/c++
|
||||||
|
|
||||||
|
# Shared library extension (with '.' separator)
|
||||||
|
EXT_SO = .dylib
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user