-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (32 loc) · 1.03 KB
/
Makefile
File metadata and controls
44 lines (32 loc) · 1.03 KB
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
#BOOST_ROOT := /home/dulitha/boost/1_71_0/gcc/5.4.0/
BOOST_DIR := $(BOOST_ROOT)/include
CXX := -c++
CXXFLAGS := -pedantic-errors -Wall -Wextra -std=c++14 -g
LDFLAGS := -L/usr/lib -lstdc++ -lm -L $(BOOST_ROOT)/lib -lboost_serialization
BUILD := ./build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/apps
TARGET := program
INCLUDE := -IDORM/include -Iinclude/ -I$(BOOST_DIR)
SRC := \
$(wildcard src/*.cpp) \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(APP_DIR)/$(TARGET)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
g++ -o $(APP_DIR)/$(TARGET) $(SRC) $(INCLUDE) $(CXXFLAGS) $(LDFLAGS)
#$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGET) $(OBJECTS)
.PHONY: all build clean debug release
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
debug: CXXFLAGS += -DDEBUG -g
debug: all
release: CXXFLAGS += -O2
release: all
clean:
-@rm -rvf $(OBJ_DIR)/*
-@rm -rvf $(APP_DIR)/*