Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add old build #72

Merged
merged 9 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Makefile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear @addman2, could you provide an example make.inc? (I guess it is the same as the old turbo's one).

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include make.inc

all:
make -C src/m_pfapack -f Makefile
make -C src/m_common -f Makefile
make -C src/d_qlapack -f Makefile
make -C src/c_adjoint_forward -f Makefile
make -C src/c_adjoint_backward -f Makefile
make -C src/b_complex -f Makefile
make -C src/a_turborvb -f Makefile

clean:
rm -rf $(BUILD_DIR)

91 changes: 91 additions & 0 deletions src/a_turborvb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Load settings

include ../../make.inc

# Variables

SRC_DIR := .
MAIN_BUILD_DIR := $(BUILD_DIR)/main
MODULE_DIR := $(BUILD_DIR)/modules
TARGET := $(BUILD_DIR)/turborvb.x
TARGET_NAME := $(BUILD_DIR)/turborvb$(SUFFIX).x
TARGET_MODULES := $(BUILD_DIR)/adjoint_forward_module.a

# File Lists
#
# First set modules:

MODULE_SRCS := $(SRC_DIR)/scal_lins.f90

MODULE_OBJS := $(MODULE_SRCS:%=$(MAIN_BUILD_DIR)/%.o)
MODULE_MODS := $(MODULE_SRCS:%=$(BUILD_DIR)/%.mod)

# Set rest files
SRCS := $(wildcard $(SRC_DIR)/*.f90)
SRCS += $(wildcard $(SRC_DIR)/*.c)
SRCS := $(filter-out $(MODULE_SRCS), $(SRCS))
OBJS := $(SRCS:%=$(MAIN_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(MAIN_BUILD_DIR)
mkdir -p $(MODULE_DIR)
echo $(MODULE_OBJS)

# Compile modules
$(MAIN_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) -J $(MODULE_DIR) -I $(MODULE_DIR) -c $< -o $@

# Common module
$(TARGET_MODULES): $(MODULE_OBJS)
$(AR) $(ARFLAGS) $(TARGET_MODULES) $(MODULE_OBJS)

# Rule for making the target
$(TARGET): $(TARGET_MODULES) $(OBJS)
$(FC) $(FLINK) \
$(OBJS) \
$(MODULE_OBJS) \
$(BUILD_DIR)/complex.a \
$(BUILD_DIR)/complex_module.a \
$(BUILD_DIR)/adjoint_forward.a \
$(BUILD_DIR)/adjoint_forward_module.a \
$(BUILD_DIR)/adjoint_backward.a \
$(BUILD_DIR)/qlapack.a \
$(BUILD_DIR)/common.a \
$(BUILD_DIR)/common_module.a \
$(BUILD_DIR)/pfapack.a \
$(BUILD_DIR)/complex.a \
$(BUILD_DIR)/complex_module.a \
$(BUILD_DIR)/adjoint_forward.a \
$(BUILD_DIR)/adjoint_forward_module.a \
$(BUILD_DIR)/adjoint_backward.a \
$(BUILD_DIR)/qlapack.a \
$(BUILD_DIR)/common.a \
$(BUILD_DIR)/common_module.a \
$(BUILD_DIR)/pfapack.a \
-J $(MODULE_DIR) \
$(LINK_LIBS) \
-o $(TARGET)

################################################################################

# Generic rule for compiling Fortran files
$(MAIN_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) \
$(MODULE_STORE) $(MODULE_DIR) \
-c $< -o $@ \
$(MODULE_INCLUDE) $(MODULE_DIR)

# Generic rule for compiling C files
$(MAIN_BUILD_DIR)/%.c.o: %.c
$(CC) $(CFLAGS) -c $< -o $(SUFFIX)

# Cleaning everything
clean:
rm -rf $(BUILD_DIR)

.PHONY: all dirs clean

49 changes: 49 additions & 0 deletions src/c_adjoint_backward/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Load settings

include ../../make.inc

# Variables

SRC_DIR := .
ADJOINT_BACKWARD_BUILD_DIR := $(BUILD_DIR)/adjoint_backward
MODULE_DIR := $(BUILD_DIR)/modules
TARGET := $(BUILD_DIR)/adjoint_backward.a

# File Lists
#
# First set modules:

# Set rest files
SRCS := $(wildcard $(SRC_DIR)/*.f90)
OBJS := $(SRCS:%=$(ADJOINT_BACKWARD_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(ADJOINT_BACKWARD_BUILD_DIR)
mkdir -p $(MODULE_DIR)
echo $(MODULE_OBJ)

# Rule for making the target
$(TARGET): $(TARGET_MODULES) $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $(OBJS) $(TARGET_MODULES)

# Generic rule for compiling Fortran files
$(ADJOINT_BACKWARD_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) \
$(MODULE_STORE) $(MODULE_DIR) \
$(MODULE_INCLUDE) $(MODULE_DIR) \
-c $< -o $@

# Generic rule for compiling C files
$(ADJOINT_BACKWARD_BUILD_DIR)/%.c.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

# Cleaning everything
clean:
rm -rf $(BUILD_DIR)

.PHONY: all dirs clean

67 changes: 67 additions & 0 deletions src/c_adjoint_forward/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Load settings

include ../../make.inc

# Variables

SRC_DIR := .
ADJOINT_FORWARD_BUILD_DIR := $(BUILD_DIR)/adjoint_forward
MODULE_DIR := $(BUILD_DIR)/modules
TARGET := $(BUILD_DIR)/adjoint_forward.a
TARGET_MODULES := $(BUILD_DIR)/adjoint_forward_module.a

# File Lists
#
# First set modules:

MODULE_SRCS := $(SRC_DIR)/dspev_drv.f90

MODULE_OBJS := $(MODULE_SRCS:%=$(ADJOINT_FORWARD_BUILD_DIR)/%.o)
MODULE_MODS := $(MODULE_SRCS:%=$(BUILD_DIR)/%.mod)

# Set rest files
SRCS := $(wildcard $(SRC_DIR)/*.f90)
SRCS += $(wildcard $(SRC_DIR)/*.c)
SRCS := $(filter-out $(MODULE_SRCS), $(SRCS))
OBJS := $(SRCS:%=$(ADJOINT_FORWARD_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(ADJOINT_FORWARD_BUILD_DIR)
mkdir -p $(MODULE_DIR)
echo $(MODULE_OBJ)

# Compile modules
$(ADJOINT_FORWARD_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) -J $(MODULE_DIR) -I $(MODULE_DIR) -c $< -o $@

# Common module
$(TARGET_MODULES): $(MODULE_OBJS)
$(AR) $(ARFLAGS) $(TARGET_MODULES) $(MODULE_OBJS)

# Rule for making the target
$(TARGET): $(TARGET_MODULES) $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $(OBJS) $(TARGET_MODULES)

################################################################################

# Generic rule for compiling Fortran files
$(ADJOINT_FORWARD_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) \
$(MODULE_STORE) $(MODULE_DIR) \
$(MODULE_INCLUDE) $(MODULE_DIR) \
-c $< -o $@

# Generic rule for compiling C files
$(ADJOINT_FORWARD_BUILD_DIR)/%.c.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

# Cleaning everything
clean:
rm -rf $(BUILD_DIR)

.PHONY: all dirs clean

40 changes: 40 additions & 0 deletions src/d_qlapack/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Load settings

include ../../make.inc

# Variables

SRC_DIR := .
QLAPACK_BUILD_DIR := $(BUILD_DIR)/qlapack
MODULE_DIR := $(BUILD_DIR)/modules
TARGET := $(BUILD_DIR)/qlapack.a

# Set rest files
SRCS := $(wildcard $(SRC_DIR)/*.f)
OBJS := $(SRCS:%=$(QLAPACK_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(QLAPACK_BUILD_DIR)
echo $(OBJS)

# Generic rule for compiling Fortran files
$(QLAPACK_BUILD_DIR)/%.f.o: %.f
$(FC) $(FCFLAGS) \
$(MODULE_STORE) $(MODULE_DIR) \
$(MODULE_INCLUDE) $(MODULE_DIR) \
-c $< -o $@

# Rule for making the target
$(TARGET): $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $(OBJS)

# Cleaning everything
clean:
rm -rf $(BUILD_DIR)

.PHONY: all dirs clean

77 changes: 77 additions & 0 deletions src/m_common/Makefile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @addman2, here you include both make.txt and make.inc. what is the difference?

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Load settings

include ../../make.inc
include ../../make.txt

# Variables

SRC_DIR := .
COMMON_BUILD_DIR := $(BUILD_DIR)/common
COMMON_MODULES_BUILD_DIR := $(BUILD_DIR)/common
MODULE_DIR := $(BUILD_DIR)/modules
TARGET := $(BUILD_DIR)/common.a
TARGET_MODULES := $(BUILD_DIR)/common_module.a

# File Lists
#
# First set modules:

MODULE_SRCS := $(SRC_DIR)/constants.f90 \
$(SRC_DIR)/symmetries.f90 \
$(SRC_DIR)/cell.f90 \
$(SRC_DIR)/dielectric.f90 \
$(SRC_DIR)/ewald.f90 \
$(SRC_DIR)/types.f90 \
$(SRC_DIR)/kpoints.f90 \
$(SRC_DIR)/mod_IO.f90 \
$(SRC_DIR)/mod_extpot.f90 \
$(SRC_DIR)/sub_comm.f90 \
$(SRC_DIR)/mpiio.f90 \
$(SRC_DIR)/kind.f90 \

MODULE_OBJS := $(MODULE_SRCS:%=$(COMMON_MODULES_BUILD_DIR)/%.o)
MODULE_MODS := $(MODULE_SRCS:%=$(BUILD_DIR)/%.mod)

# Set rest files
SRCS := $(wildcard $(SRC_DIR)/*.f90)
SRCS += $(wildcard $(SRC_DIR)/*.c)
SRCS := $(filter-out $(MODULE_SRCS), $(SRCS))
OBJS := $(SRCS:%=$(COMMON_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(COMMON_BUILD_DIR)
mkdir -p $(COMMON_MODULES_BUILD_DIR)
mkdir -p $(MODULE_DIR)

# Common module
$(TARGET_MODULES): $(MODULE_OBJS)
$(AR) $(ARFLAGS) $(TARGET_MODULES) $(MODULE_OBJS)

# Rule for making the target
$(TARGET): $(TARGET_MODULES) $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $(OBJS) $(TARGET_MODULES)

################################################################################

# Generic rule for compiling Fortran files
#$(COMMON_BUILD_DIR)/%.f90.o: %.f90
$(COMMON_BUILD_DIR)/%.f90.o: %.f90
$(FC) $(FCFLAGS) \
-J$(MODULE_DIR) \
-c $< -o $@

# Generic rule for compiling C files
$(COMMON_BUILD_DIR)/%.c.o: %.c
$(CC) $(CFLAGS) \
-c $< -o $@

# Cleaning everything
clean:
rm -rf $(BUILD_DIR)

.PHONY: all dirs clean

35 changes: 35 additions & 0 deletions src/m_pfapack/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Load settings

include ../../make.inc

# Variables

PFAPACK_SRC_DIR := .
PFAPACK_BUILD_DIR := $(BUILD_DIR)/pfapack
TARGET := $(BUILD_DIR)/pfapack.a

# File Lists
SRCS := $(wildcard $(PFAPACK_SRC_DIR)/*.f)
OBJS := $(SRCS:%=$(PFAPACK_BUILD_DIR)/%.o)

# Default rule
all: dirs $(TARGET)

# Rule for making the build directory
dirs:
mkdir -p $(PFAPACK_BUILD_DIR)

# Rule for making the target
$(TARGET): $(OBJS)
$(AR) $(ARFLAGS) $(TARGET) $(OBJS)

# Generic rule for compiling CPP files
$(PFAPACK_BUILD_DIR)/%.f.o: %.f
$(FC) $(FCFLAGS) -c $< -o $@

# Cleaning everything
clean:
rm -rf $(PFAPACK_BUILD_DIR)

.PHONY: all dirs clean