-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (53 loc) · 1.48 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
#############################################################################
# Makefile for building PathPlannerDemo
# Command: make planner-demo
#############################################################################
###### Configuration
CXX = g++
DEBUG_LEVEL = 1
##### Setup Flags
CXXFLAGS = -std=c++17 -fPIC -Wno-unknown-pragmas #-fstack-protector-all
LIBS = -lX11 -lGL -lpthread -lpng -lstdc++fs
WARN_ON = -Wall -Wextra -Wconversion
WARN_OFF = -Wno-narrowing
DEBUG_FLAGS = -g
RELEASE_FLAGS = -Ofast
ifeq ($(strip $(WARNINGS)),YES)
CXXFLAGS += $(WARN_ON)
else
CXXFLAGS += $(WARN_OFF)
endif
ifeq ($(strip $(DEBUG_LEVEL)),1)
CCFLAGS += $(DEBUG_FLAGS) -O3
CXXFLAGS += $(DEBUG_FLAGS) -O3
else
ifeq ($(strip $(DEBUG_LEVEL)),2)
CCFLAGS += $(DEBUG_FLAGS) -O0
CXXFLAGS += $(DEBUG_FLAGS) -O0
else
CCFLAGS += $(RELEASE_FLAGS)
CXXFLAGS += $(RELEASE_FLAGS)
endif
endif
####### Directories
SRCDIR = $(CURDIR)/src
OBJDIR = $(CURDIR)/obj
BINDIR = $(CURDIR)/bin
INCS += -I$(CURDIR)/include
# INCS += -I/home/jacob/.local/include/c++/11.2.1/
####### Files
OBJS = $(OBJDIR)/main.o \
$(OBJDIR)/astar.o \
$(OBJDIR)/gamemap.o
TARGET = planner-demo
####### Build rules
$(TARGET): $(OBJS)
@mkdir -p $(BINDIR)
$(CXX) $(INCS) $(OBJS) $(LIBS) $(CXXFLAGS) -o $(BINDIR)/$(TARGET)
$(OBJDIR)/%.o: src/%.cpp include/%.hpp
@mkdir -p $(OBJDIR)
$(CXX) $(INCS) -c -o $@ $< $(FLAGS) $(CXXFLAGS)
####### Phony Targets
.PHONY: clean
clean:
cd obj && rm -f *.o && cd .. && rm -f $(BINDIR)/$(TARGET)