-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
85 lines (59 loc) · 2.11 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
82
83
84
# Makefile for DeepEfficiency (C++ parts)
#
#
# Run with: make
#
#
# USE [TABS] for intendation while modifying this!
#
# [email protected], 26/07/2018
# ------------------------------------------------------------------------
# ROOT installation path
ROOTLIBDIR = $(shell root-config --libdir)
# ------------------------------------------------------------------------
# Libraries
# ROOT
ROOTlib = -L$(ROOTLIBDIR) -lCore -lCore -lCint -lRIO -lNet \
-lHist -lGraf -lGraf3d -lGpad -lTree -lRint \
-lPostscript -lMatrix -lPhysics -lMathCore \
-lThread -lGui -lRooFit -lMinuit
# C++ standard
STANDARDlib = -pthread -rdynamic -lm -ldl -lrt
# ------------------------------------------------------------------------
# Compiler options
CXX = g++
INCLUDES = -Iinclude -Ilib
INCLUDES += $(STANDARDlib)
INCLUDES += -I/usr/include
INCLUDES += -I$(ROOTSYS)/include
CXXFLAGS = -ansi -pedantic -Wall -pipe -march=native -O2 -ftree-vectorize -std=c++17 $(INCLUDES)
# CPU optimization with -march=native
# Autovectorization with -free-vectorize
# Floating point super-optimization with -ffast-math (fast but breaks floating point standards!)
# -O2 is safe, -O3 usually too
# Faster compilation with -pipe
# Profiling with -pg (REMEMBER TO REMOVE, MAKES A SIGNIFICANT PERFORMANCE HIT)
# ------------------------------------------------------------------------
# Source and objects
SRC_DIR = src
OBJ_DIR = obj
SRC = $(wildcard $(SRC_DIR)/*.cc)
OBJ = $(SRC:$(SRC_DIR)/%.cc=$(OBJ_DIR)/%.o)
LINK_LIBS += $(ROOTlib)
# ------------------------------------------------------------------------
.SUFFIXES: .o .cc
all: libraries deeplot
# Object files
libraries: $(OBJ)
# Programs
deeplot: deeplot.o $(OBJ)
$(CXX) [email protected] $(OBJ) $(LINK_LIBS) -o $@ $(CXXFLAGS)
# ------------------------------------------------------------------------
# Compile objects (.o) from sources (.cc)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc
$(CXX) $(CXXFLAGS) -c $< -o $@
# ------------------------------------------------------------------------
# Remove any object files
clean:
rm *.o
rm $(OBJ_DIR)/*.o