-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (31 loc) · 1.21 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
# Based on code taken from Brigitte, written by Alban Grastien
SRC_DIR = src
OBJ_DIR = obj
SRC_DIRECTORIES = $(shell find $(SRC_DIR) -type d)
CPP_FILES = $(foreach dir,$(SRC_DIRECTORIES),$(wildcard $(dir)/*.cpp))
OBJ_DIRECTORIES = $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(SRC_DIRECTORIES))
OBJ = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(CPP_FILES))
EXE_NAME = silo
OPTIMIZATION_LEVEL=-O3
CONCURRENCY_ARGUMENTS=-pthread
# Use this to disable assertions. "ASSERTION_ARGUMENTS=-DNDEBUG" should work.
ASSERTION_ARGUMENTS=
#ASSERTION_ARGUMENTS=-DNDEBUG
build: $(OBJ)
g++ -Wall -o $(EXE_NAME) $(OPTIMIZATION_LEVEL) $(ADDITIONAL_ARGUMENTS) $(OBJ) $(CONCURRENCY_ARGUMENTS) $(ASSERTION_ARGUMENTS)
debug: OPTIMIZATION_LEVEL=-Og
debug: ADDITIONAL_ARGUMENTS=-g
debug: build
run:
./$(EXE_NAME)
all : build run
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/%.hpp
mkdir -p $(dir $@)
g++ -Wall -c $< -std=c++11 $(OPTIMIZATION_LEVEL) $(ADDITIONAL_ARGUMENTS) $(CONCURRENCY_ARGUMENTS) $(ASSERTION_ARGUMENTS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
mkdir -p $(dir $@)
g++ -Wall -c $< -std=c++11 $(OPTIMIZATION_LEVEL) $(ADDITIONAL_ARGUMENTS) $(CONCURRENCY_ARGUMENTS) $(ASSERTION_ARGUMENTS) -o $@
clean:
rm -f $(OBJ)
rm -f $(EXE_NAME)
# eof