Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Coon, Ethan
ELM_Kernels
Commits
c7b50ed0
Commit
c7b50ed0
authored
Feb 20, 2019
by
Ethan Coon
Browse files
rework of makefiles to get all to work in one way, even legion ones
parent
6e02111c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/config/Makefile.config
View file @
c7b50ed0
...
...
@@ -7,40 +7,32 @@ NETCDF_ROOT = /Users/uec/codes/ats/amanzi-tpls/install-0.88
# assumes you have a working fortran and c++ compilers with libraries
FC
=
gfortran
FCFLAGS
=
-
Wall
-
Wunused
-
fimplicit
-
none
-
free
-
g3
-
fbounds
-
check
-
fbacktrace
#
FC
FLAGS = -Wall -Wunused -fimplicit-none -free -O3
FC
_
FLAGS
= -
fimplicit
-
none
-
free
-
g3
-
fbounds
-
check
-
fbacktrace
FC
_LIB_ROOT
= /
usr
/
local
/
Cellar
/
gcc
/
8
.
2
.
0
/
lib
/
gcc
/
8
CC
=
clang
++
CPPFLAGS
= -
g
-
Wall
-
std
=
c
++
11
CPP
_
FLAGS
= -
g
-
Wall
-
Wshadow
-
std
=
c
++
11
STD_LIB_ROOT
= /
usr
# note, the linker should almost always be your fortran compiler, NOT your c compiler
LINKER
=
gfortran
#LINKER = gfortran
CC_LD_FLAGS
= -
L
$(
OBJECT
)
fortran
-
lelm
-
L
$(
NETCDF_ROOT
)/
lib
-
lnetcdf
-
L
$(
STD_LIB_ROOT
)/
lib
-
lc
++ -
L
$(
FC_LIB_ROOT
) -
lgfortran
FC_LD_FLAGS
= -
L
$(
OBJECT
)
fortran
-
lelm
-
L
$(
NETCDF_ROOT
)/
lib
-
lnetcdff
# ------------------------------------------------
# Hopefully below shouldn't have to be changed.
# ------------------------------------------------
.
PRECIOUS
: %.
o
.
SUFFIXES
:
.
PHONY
:
all
.
SUFFIXES
: .
o
.
F
.
f
.
c
.
C
.
cc
.
cxx
.
F90
.
PRECIOUS
: %.
cc
.
o
%.
F90
.
o
.
SUFFIXES
: .
cc
.
o
.
F90
.
o
.
cc
.
F90
.
F90
.
o
:
$(
FC
) $(
FCFLAGS
) -
c
$< -
o
$@
.
F
.
o
:
$(
F77
) $(
FFLAGS
) -
c
$< -
o
$@
.
f
.
o
:
$(
F77
) $(
FFLAGS
) -
c
$< -
o
$@
.
cc
.
o
:
$(
CC
) $(
CFLAGS
) $(
CPPFLAGS
) -
c
$< -
o
$@
.
cxx
.
o
:
$(
CXX
) $(
CFLAGS
) $(
CPPFLAGS
) -
c
$< -
o
$@
#%.o : %.F90
# $(FC) -c $(FCFLAGS) $< -o $@
%.
F90
.
o
: %.
F90
$(
FC
) $(
FC_FLAGS
) -
c
$< -
o
$@
%.
cc
.
o
: %.
cc
$(
CXX
) $(
CC_FLAGS
) $(
CPP_FLAGS
) $(
INC_FLAGS
) -
c
$< -
o
$@
SHELL
= /
bin
/
sh
...
...
@@ -65,7 +57,7 @@ AR = ar
# Rules used in all directories.
######################################################################
ELM_CLEAN
=$(
RM
) *.
o
*.
ii
*.
int
.
c
*.
log
*.
log
.*
stamp
-*
core
core
.*
stats
-
r
ti_files
ii_files
*.
mod
*.
a
ELM_CLEAN
=$(
RM
)
-
f
*.
o
*.
ii
*.
int
.
c
*.
log
*.
log
.*
stamp
-*
core
core
.*
stats
-
r
ti_files
ii_files
*.
mod
*.
a
src/fortran/Makefile
View file @
c7b50ed0
...
...
@@ -8,19 +8,19 @@ FCFLAGS += -I$(ELM_UTILS_DIR)
# Order is important due to .mod file creation
OBJS
=
\
$(ELM_UTILS_DIR)
/shr_kind_mod.o
\
$(ELM_UTILS_DIR)
/shr_sys_mod.o
\
$(ELM_UTILS_DIR)
/shr_infnan_mod.o
\
$(ELM_UTILS_DIR)
/shr_strconvert_mod.o
\
$(ELM_UTILS_DIR)
/shr_assert_mod.o
\
landunit_varcon.o
\
column_varcon.o
\
clm_varpar.o
\
clm_varctl.o
\
CanopyHydrology_Interception.o
\
CanopyHydrology_SnowWater.o
\
CanopyHydrology_FracWet.o
\
CanopyHydrology_FracH2OSfc.o
$(ELM_UTILS_DIR)
/shr_kind_mod.
F90.
o
\
$(ELM_UTILS_DIR)
/shr_sys_mod.
F90.
o
\
$(ELM_UTILS_DIR)
/shr_infnan_mod.
F90.
o
\
$(ELM_UTILS_DIR)
/shr_strconvert_mod.
F90.
o
\
$(ELM_UTILS_DIR)
/shr_assert_mod.
F90.
o
\
landunit_varcon.
F90.
o
\
column_varcon.
F90.
o
\
clm_varpar.
F90.
o
\
clm_varctl.
F90.
o
\
CanopyHydrology_Interception.
F90.
o
\
CanopyHydrology_SnowWater.
F90.
o
\
CanopyHydrology_FracWet.
F90.
o
\
CanopyHydrology_FracH2OSfc.
F90.
o
all
:
$(OBJS)
$(AR)
cr libelm.a
$(OBJS)
...
...
tests/tests_c/Makefile
View file @
c7b50ed0
...
...
@@ -4,7 +4,7 @@ OBJECT = ../../src/
include
$(OBJECT)config/Makefile.config
CPP
FLAGS
+
=
-I
$(
CSRCDIR)
-I
$(NETCDF_ROOT)
/include
INC_
FLAGS
=
-I
$(
AMANZI_TPLS_DIR)
/include
-I
../../src/cpp
-I
../tests_c
TESTS
=
test_CanopyHydrology_kern1_single
\
...
...
@@ -36,8 +36,8 @@ CanopyHydrology_module: test_CanopyHydrology_module
./test_CanopyHydrology_module &> test_CanopyHydrology_module.stdout
test_%
:
%.o readers.hh utils.hh
$(
LINKER)
$(FCFLAGS)
-L
$(OBJECT)
fortran
-lelm
-L
$(NETCDF_ROOT)
/lib
-lnetcdf
-L
$(STD_LIB_ROOT)
/lib
-lc
++
$<
-o
$@
test_%
:
%.
cc.
o readers.hh utils.hh
library
$(
CXX)
-o
$@
$<
$(CC_LD_FLAGS)
clean
:
...
...
tests/tests_f/Makefile
View file @
c7b50ed0
...
...
@@ -2,7 +2,8 @@ SRCDIR = ../../src/fortran/
OBJECT
=
../../src/
include
$(OBJECT)config/Makefile.config
FCFLAGS
+=
-I
$(SRCDIR)
-I
$(SRCDIR)$(ELM_UTILS_DIR)
-I
$(NETCDF_ROOT)
/include
FC_FLAGS
+=
-I
$(SRCDIR)
-I
$(SRCDIR)$(ELM_UTILS_DIR)
-I
$(NETCDF_ROOT)
/include
TESTS
=
test_CanopyHydrology_kern1_single
\
...
...
@@ -33,8 +34,8 @@ CanopyHydrology_module: test_CanopyHydrology_module
./test_CanopyHydrology_module &> test_CanopyHydrology_module.stdout
test_%
:
%.o library
$(
LINKER)
$(FCFLAGS)
-L
$(OBJECT)
fortran
-lelm
-L
$(NETCDF_ROOT)
/lib
-lnetcdff
$<
-o
$@
test_%
:
%.
F90.
o library
$(
FC)
-o
$@
$<
$(FC_LD_FLAGS)
clean
:
...
...
tests/tests_legion/Makefile
View file @
c7b50ed0
...
...
@@ -4,10 +4,6 @@ endif
# from Makefile.config
OBJECT
=
../../src/
NETCDF_ROOT
=
/Users/uec/codes/ats/amanzi-tpls/install-0.88
STD_LIB_ROOT
=
/usr
# Flags for directing the runtime makefile what to include
DEBUG
?=
1
# Include debugging symbols
...
...
@@ -19,22 +15,106 @@ USE_HDF ?= 0 # Include HDF5 support (requires HDF5)
ALT_MAPPERS
?=
0
# Include alternative mappers
(
not recommended
)
# Put the binary file name here
OUTFILE
?=
CanopyHydrology_kern1_multiple
# List all the application source files here
GEN_SRC
?=
CanopyHydrology_kern1_multiple.cc
# .cc files
# You can modify these variables, some will be appended to by the runtime makefile
INC_FLAGS
?=
-I
$(AMANZI_TPLS_DIR)
/include
-I
../../src/cpp
-I
../tests_c
CC_FLAGS
?=
-std
=
c++11
NVCC_FLAGS
?=
GASNET_FLAGS
?=
LD_FLAGS
?=
-L
$(OBJECT)
fortran
-lelm
-L
$(NETCDF_ROOT)
/lib
-lnetcdf
-L
$(STD_LIB_ROOT)
/lib
-lc
++
###########################################################################
#
# Don't change anything below here
#
###########################################################################
include
$(OBJECT)config/Makefile.config
TESTS
=
test_CanopyHydrology_kern1_multiple
#
\
# test_CanopyHydrology_module
EXEC_TESTS
=
CanopyHydrology_kern1_multiple
#
\
# CanopyHydrology_module
#
# Load Legion logic, but not rules
#
NO_BUILD_RULES
=
1
include
$(LG_RT_DIR)/runtime.mk
#
# Legion rules
#
.PHONY
:
links library test
default
:
all
all
:
links library $(TESTS)
test
:
$(EXEC_TESTS)
python ../compare_to_gold.py
$(TESTS)
CanopyHydrology_kern1_multiple
:
test_CanopyHydrology_kern1_multiple
./test_CanopyHydrology_kern1_multiple &> test_CanopyHydrology_kern1_multiple.stdout
# If we're using CUDA we have to link with nvcc
test_%
:
%.cc.o $(GEN_OBJS) $(GEN_GPU_OBJS) $(SLIB_LEGION) $(SLIB_REALM)
@
echo
"---> Linking objects into one binary:
$
()"
$(CXX)
-o
$@
$<
$(GEN_OBJS)
$(GEN_GPU_OBJS)
$(CC_LD_FLAGS)
$(LEGION_LIBS)
$(LEGION_LD_FLAGS)
$(GASNET_FLAGS)
$(SLIB_LEGION)
:
$(LEGION_OBJS) $(MAPPER_OBJS)
rm
-f
$@
$(AR)
rc
$@
$^
$(SLIB_REALM)
:
$(REALM_OBJS)
rm
-f
$@
$(AR)
rc
$@
$^
$(GEN_OBJS)
:
%.cc.o : %.cc
$(CXX)
-o
$@
-c
$<
$(CC_FLAGS)
$(INC_FLAGS)
$(ASM_OBJS)
:
%.S.o : %.S
$(CXX)
-o
$@
-c
$<
$(CC_FLAGS)
$(INC_FLAGS)
$(REALM_OBJS)
:
%.cc.o : %.cc
$(CXX)
-o
$@
-c
$<
$(CC_FLAGS)
$(INC_FLAGS)
$(LEGION_OBJS)
:
%.cc.o : %.cc
$(CXX)
-o
$@
-c
$<
$(CC_FLAGS)
$(INC_FLAGS)
$(MAPPER_OBJS)
:
%.cc.o : %.cc
$(CXX)
-o
$@
-c
$<
$(CC_FLAGS)
$(INC_FLAGS)
$(GEN_GPU_OBJS)
:
%.cu.o : %.cu
$(NVCC)
-o
$@
-c
$<
$(NVCC_FLAGS)
$(INC_FLAGS)
$(GPU_RUNTIME_OBJS)
:
%.cu.o : %.cu
$(NVCC)
-o
$@
-c
$<
$(NVCC_FLAGS)
$(INC_FLAGS)
# disable gmake's default rule for building % from %.o
#% : %.o
#%.cc.o : %.cc domains.hh readers.hh utils.hh
# $(CXX) -o $@ -c $< $(CC_FLAGS) $(INC_FLAGS)
clean
:
$(ELM_CLEAN)
allclean
:
clean
$(MAKE)
-C
$(OBJECT)
allclean
$(RM)
-f
$(SLIB_LEGION)
$(SLIB_REALM)
$(GEN_OBJS)
$(GEN_GPU_OBJS)
$(REALM_OBJS)
$(LEGION_OBJS)
$(GPU_RUNTIME_OBJS)
$(MAPPER_OBJS)
$(ASM_OBJS)
ifeq
($(strip $(USE_LLVM)),1)
llvmjit_internal.cc.o
:
CC_FLAGS += $(LLVM_CXXFLAGS)
%/llvmjit_internal.cc.o
:
CC_FLAGS += $(LLVM_CXXFLAGS)
endif
links
:
@
echo
"making in links"
$(MAKE)
-C
../links links
library
:
$(MAKE)
-C
$(OBJECT)
all
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment