-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
69 lines (51 loc) · 1.89 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
# NOTE: FOLDERS WILL BE CREATED IF NOT EXISTENT
OBJ_DIR = obj
SRC_DIR = src
ME_DIR = me_files
FLAG_DIR = flag_files
OBME_DIR = obme
TBME_DIR = tbme
REF_DIR = ref_files
OUTPUT = sdp_files
BINARY = run_rdm
SRCS = $(wildcard $(SRC_DIR)/*.cpp)
OBJS = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS))
###########################################################################
# Commands and options for compiling
###########################################################################
CC = g++ -std=c++11
CFLAGS = -g -O3 -fopenmp
LDFLAGS = -g
WARNFLAGS = -Wall -Wextra -Wshadow -fno-common -Wno-unused-parameter
MOREFLAGS = -ansi -pedantic -Wpointer-arith -Wcast-qual -Wcast-align \
-Wwrite-strings -fshort-enums
LDLIBS = -lgsl -lgslcblas -lgomp
###########################################################################
# Instructions to compile and link -- allow for different dependencies
###########################################################################
all: $(BINARY)
$(BINARY): $(OBJS) | $(OBJ_DIR)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@ $(WARNFLAGS)
#$(OBJ_DIR)/%.o: %.cpp $(HDRS)
# $(CC) $(CFLAGS) -c $< -o $@
##########################################################################
# Additional tasks
##########################################################################
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
mkdir -p $(OUTPUT)
mkdir -p $(FLAG_DIR)
mkdir -p $(ME_DIR)
cd $(ME_DIR) && mkdir -p $(OBME_DIR)
cd $(ME_DIR) && mkdir -p $(TBME_DIR)
cd $(ME_DIR) && mkdir -p $(REF_DIR)
.PHONY: all clean
clean:
rm -f $(OBJ_DIR)/*.o
zip:
zip -r $(COMMAND).zip $(MAKEFILE) $(SRCS) $(HDRS)
##########################################################################
# End of makefile
##########################################################################