Merge pull request #38 from fmgjcoppens:fix/makefile

Fixed Makefiles
This commit is contained in:
François Coppens 2021-05-21 16:38:23 +02:00 committed by GitHub
commit 8883bb3372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 15 deletions

View File

@ -21,16 +21,22 @@ else
$(error No valid compiler environment set in $$ENV. \ $(error No valid compiler environment set in $$ENV. \
First run: $$ source smvars.sh {intel | llvm | gnu}) First run: $$ source smvars.sh {intel | llvm | gnu})
endif endif
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG) $(THRESHOLD) -fPIC
ifeq ($(MKL),-DMKL)
CXXFLAGS += $(MKL)
LFLAGS = -mkl=sequential
H5LFLAGS = -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
endif
FFLAGS = $(CXXFLAGS)
H5CXX = h5c++ H5CXX = h5c++
H5CXXFLAGS = $(CXXFLAGS)
FLIBS = -lstdc++ FLIBS = -lstdc++
CXXFLAGS = $(OPT) $(ARCH) $(DEBUG) $(THRESHOLD) -fPIC
## MKL linker flags
ifeq ($(MKL),-DMKL)
CXXFLAGS += $(MKL)
H5LFLAGS = -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
ifeq ($(ENV),INTEL)
LFLAGS = -mkl=sequential # implicit
else
LFLAGS = $(H5LFLAGS)
endif
endif
H5CXXFLAGS = $(CXXFLAGS)
FFLAGS = $(CXXFLAGS)
## Includes and dependencies ## Includes and dependencies
INCLUDE = -I $(INC_DIR)/ INCLUDE = -I $(INC_DIR)/

View File

@ -13,6 +13,17 @@ H5FLAGS = "-I/usr/include/hdf5/serial \
-lpthread -lsz -lz -ldl -lm \ -lpthread -lsz -lz -ldl -lm \
-Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/serial" -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/serial"
CXXFLAGS = -O0 -g $(H5FLAGS) CXXFLAGS = -O0 -g $(H5FLAGS)
## MKL linker flags
ifeq ($(MKL),-DMKL)
CXXFLAGS += $(MKL)
H5LFLAGS = -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl
ifeq ($(ENV),INTEL)
LFLAGS = -mkl=sequential # implicit
else
LFLAGS = $(H5LFLAGS)
endif
endif
H5CXXFLAGS = $(CXXFLAGS)
FFLAGS = $(CXXFLAGS) FFLAGS = $(CXXFLAGS)
INCLUDE = -I $(INC_DIR)/ INCLUDE = -I $(INC_DIR)/
@ -79,19 +90,19 @@ $(OBJ_DIR)/%.o: $(TST_DIR)/%.f90 | $(OBJ_DIR)
#### LINKING #### LINKING
$(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/cMaponiA3_test_3x3_3.o $(DEPS_CXX) | $(BIN_DIR) $(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/cMaponiA3_test_3x3_3.o $(DEPS_CXX) | $(BIN_DIR)
$(CXX) -o $@ $^ $(CXX) $(LFLAGS) -o $@ $^
$(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR) $(BIN_DIR)/test_h5: $(OBJ_DIR)/test_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(CXX) -o $@ $^ $(H5FLAGS) $(CXX) $(H5LFLAGS) -o $@ $^ $(H5FLAGS)
$(BIN_DIR)/vfc_test_h5: $(OBJ_DIR)/vfc_test_h5.o $(DEPS_CXX) | $(BIN_DIR) $(BIN_DIR)/vfc_test_h5: $(OBJ_DIR)/vfc_test_h5.o $(DEPS_CXX) | $(BIN_DIR)
$(CXX) -o $@ $^ $(H5FLAGS) $(CXX) $(H5LFLAGS) -o $@ $^ $(H5FLAGS)
$(BIN_DIR)/fMaponiA3_test_3x3_3: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_3x3_3.o | $(BIN_DIR) $(BIN_DIR)/fMaponiA3_test_3x3_3: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_3x3_3.o | $(BIN_DIR)
$(FC) $(FLIBS) -o $@ $^ $(FC) $(LFLAGS) $(FLIBS) -o $@ $^
$(BIN_DIR)/fMaponiA3_test_4x4_2: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_4x4_2.o | $(BIN_DIR) $(BIN_DIR)/fMaponiA3_test_4x4_2: $(DEPS_F) $(OBJ_DIR)/fMaponiA3_test_4x4_2.o | $(BIN_DIR)
$(FC) $(FLIBS) -o $@ $^ $(FC) $(LFLAGS) $(FLIBS) -o $@ $^
$(BIN_DIR)/QMCChem_dataset_test: $(DEPS_F) $(OBJ_DIR)/QMCChem_dataset_test.o | $(BIN_DIR) $(BIN_DIR)/QMCChem_dataset_test: $(DEPS_F) $(OBJ_DIR)/QMCChem_dataset_test.o | $(BIN_DIR)
$(FC) $(FLIBS) -o $@ $^ $(FC) $(LFLAGS) $(FLIBS) -o $@ $^

View File

@ -93,4 +93,4 @@ then
echo "* Threshold of '$2' will be used in next build." echo "* Threshold of '$2' will be used in next build."
export THRESHOLD="-DTHRESHOLD=$2" export THRESHOLD="-DTHRESHOLD=$2"
fi fi
fi fi