forked from Spuriosity1/AC4DC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (62 loc) · 3.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Instructions for a fresh install for C++ beginners.
# --Compiling--
#(0. Run 'sudo apt-get install build-essential' )
# 1. Install brew (e.g. linux: https://docs.brew.sh/Homebrew-on-Linux#requirements)
# 2. Run 'brew install [formula]' on following formulae: gcc@10, eigen, ncurses
# 3. Ensure correct links for INC and LIB in this file.
# 4. Run 'make'
#
# Optional (well not yet optional TODO), live plotting:
# 'brew install python3.9'
# Run 'pip3.9 install' on: pybind11, plotly, scipy.
#
# --Running (see README.md)--
# 'mv bin/ac4dc ac4dc'
# './ac4dc input/carbon_example.mol'
# If the file cannot execute it may be a linking error. Run ldd ac4dc to check dependencies.
# Tested on WSL2 (Ubuntu)
# -----------------------------------------------------------------------------------------------
CPP := g++-10 #(not g++-11)
LIB := -lncurses -fopenmp -lpython3.9 -lboost_system -lboost_filesystem # Link special external libraries here! (-L for directory of libraries). Eigen contains no source files (pure header implementation) thus is excluded.
INC := -Iinclude -I/home/linuxbrew/.linuxbrew/include/eigen3 -I/usr/include/ncursesw $(shell python3.9 -m pybind11 --includes)
SRCDIR := src
BUILDDIR := build
TARGET := bin/ac4dc
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT) )
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
CXXFLAGS := -std=c++17 -fopenmp -MD -g -Wall -L/usr/lib/x86_64-linux-gnu -lncurses
debug: CXXFLAGS += -DDEBUG -Wpedantic
release: CXXFLAGS += -O3 -DNDEBUG
# For tests:
TESTS := $(shell find tests -type f -name *.$(SRCEXT) )
TINC := $(INC) -I./
$(TARGET): $(OBJECTS)
@echo " Linking $(TARGET)... ";
@echo " $(CPP) $^ $(LIB) -o $(TARGET) "; $(CPP) $^ $(LIB) -o $(TARGET)
all: $(TARGET)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR) bin $(BUILDDIR)/Wigner $(BUILDDIR)/$(MAINSUBDIR)
@echo " $(CPP) $(CXXFLAGS) $(INC) -c -o $@ $<"; $(CPP) $(CXXFLAGS) $(INC) -c -o $@ $<
test: $(TESTS)
@mkdir -p bin/tests tmp testOutput
# $(CPP) -g -std=c++11 tests/abm_verif.cpp $(TINC) -o bin/tests/abm_verif
# $(CPP) -g tests/binsearch.cpp -o bin/tests/binsearch
# $(CPP) -g tests/spline_check.cpp src/SplineBasis.cpp $(TINC) -o bin/tests/splinecheck
# $(CPP) -g tests/test_inverse.cpp src/Constant.cpp $(TINC) -o bin/tests/rate_inverse
# $(CPP) -g $(CXXFLAGS) $(TINC) -DDEBUG tests/q_eii.cpp src/Constant.cpp src/FreeDistribution.cpp src/SplineIntegral.cpp src/SplineBasis.cpp src/Dipole.cpp -o bin/tests/q_eii
# $(CPP) -g $(CXXFLAGS) $(TINC) -DDEBUG tests/q_tbr.cpp src/Constant.cpp src/FreeDistribution.cpp src/SplineIntegral.cpp src/SplineBasis.cpp src/Dipole.cpp -o bin/tests/q_tbr
# $(CPP) -g $(CXXFLAGS) $(TINC) -DDEBUG tests/q_ee.cpp src/Constant.cpp src/FreeDistribution.cpp src/SplineIntegral.cpp src/SplineBasis.cpp src/Dipole.cpp -o bin/tests/q_ee
$(CPP) -g $(CXXFLAGS) $(TINC) -DDEBUG tests/ee_dynamics.cpp src/Constant.cpp src/FreeDistribution.cpp src/SplineIntegral.cpp src/SplineBasis.cpp src/Dipole.cpp -o bin/tests/ee_dynamics
# $(CPP) -g $(CXXFLAGS) $(TINC) -DDEBUG tests/basis_checker.cpp src/Constant.cpp src/FreeDistribution.cpp src/SplineIntegral.cpp src/SplineBasis.cpp src/Dipole.cpp -o bin/tests/basis_checker
# $(CPP) -g $(TINC) tests/sigma_test.cpp src/Dipole.cpp -o bin/tests/sigma_test
# $(CPP) -g $(TINC) -DDEBUG_VERBOSE tests/rate_io_test.cpp src/Constant.cpp -o bin/tests/rate_io
debug: all
release: all
scrub:
$(RM) build/FreeDistribution.o build/ElectronRateSolver.o build/SplineBasis.o build/SplineIntegral.o
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR)"; $(RM) -r $(BUILDDIR)
.PHONY: clean, test, all
-include $(OBJECTS:.o=.d)