-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (33 loc) · 916 Bytes
/
Makefile
File metadata and controls
42 lines (33 loc) · 916 Bytes
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
CXX := -c++
CXXFLAGS := -O2 -std=c++17 -pedantic-errors -Wall -Wextra #-Werror
LDFLAGS := -L/usr/lib -lstdc++ -lm -lz
BUILD := ./build
#do NOT blank this var
OBJ_DIR := $(BUILD)/objects
#APP_DIR := .
APP_DIR := $(BUILD)
#APP_DIR := $(BUILD)/apps
TARGET := tileSAT
INCLUDE := -Iinclude/
SRC := \
$(wildcard src/exemple/*.cpp) \
$(wildcard src/*.cpp) \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(APP_DIR)/$(TARGET)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS)
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
.PHONY: all build clean debug release
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
debug: CXXFLAGS += -DDEBUG -g
debug: all
release: CXXFLAGS += -O2 -s
release: all
clean:
-@rm -rv $(OBJ_DIR)/*
-@rm -v $(APP_DIR)/$(TARGET)