-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (62 loc) · 1.77 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
81
.KEEP_STATE:
SHELL=/bin/sh
#
# define version of c compiler and linker
#
CC= g++
LINK= g++
#
# define compiler flags
#
CFLAGS = -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual \
-Wcast-align -Wwrite-strings -fshort-enums -fno-common \
-fno-var-tracking -g -O3 -DHAVE_INLINE
LDLIBS = -lgsl -lcblas -latlas -lm
DEFNS = exp_zb_def.hh exp_wz_def.hh exp_gwz_def.hh exp_coulomb_def.hh \
exp_dielectric_def.hh exp_well_def.hh exp_lcz_def.hh \
exp_overlap_def.hh
# definition files for the gaussian radial functions, in case
# they are needed later. Note that any file which uses any of
# these headers must #include <gsl/gsl_sf_erf.h>
# gauss_zb_def.hh gauss_wz_def.hh gauss_gwz_def.hh \
# gauss_coulomb_def.hh gauss_dielectric_def.hh gauss_well_def.hh \
# gauss_lcz_def.hh gauss_hgh_def.hh gauss_overlap_def.hh
DEPS = hamiltonian.hh matrix_term.hh enums.hh defs.hh
ODIR = obj
_OBJ = main.o hamiltonian.o matrix_term.o \
matrix_term_exp.o enums.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
BIN = evals.bin
GENERATED = $(OBJ) $(BIN)
.PHONY : all
all : $(BIN)
run : $(BIN)
./$^
$(BIN) : $(OBJ)
$(LINK) -o $@ $^ $(CFLAGS) $(LDLIBS)
.PHONY : objs
objs : $(OBJ)
$(ODIR)/%.o : %.cc $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
%_def.hh : %.txt math2matrix.pl
./math2matrix.pl < $< > $@
$(ODIR)/matrix_term_%.o : matrix_term_%.cc matrix_term.hh defs.hh $(DEFNS)
$(CC) -c -o $@ $< $(CFLAGS)
# regenerate all the _def.hh files
# For some reason, the above command errors out rather than generating
# them when they don't exist.
.PHONY : defns
defns : $(DEFNS)
.PHONY : gdb
gdb : $(BIN)
gdb ./$(BIN)
.PHONY : valgrind
valgrind : $(BIN)
valgrind --trace-children=yes --leak-check=full \
--show-reachable=yes ./$(BIN)
.PHONY : clean
clean :
-rm -f $(OBJ)
.PHONY : distclean
distclean :
-rm -f $(GENERATED)