-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
39 lines (31 loc) · 760 Bytes
/
makefile
File metadata and controls
39 lines (31 loc) · 760 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
define create_dir
test -d $(1) || mkdir $(1)
endef
PROJNAME := demo
CC := g++
ifeq ($(BUILD),DEBUG)
CFLAGS := -O0 -g -Wall
else
CFLAGS := -O3
endif
CSTD := c++17
CLIBS := -lz -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
CINCLUDE := -I../unlime
TARGET := bin/$(PROJNAME)
SRC_DIR := src
OBJ_DIR := obj
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))
LDFLAGS := -std=$(CSTD) $(CFLAGS)
all: $(TARGET)
debug:
make "BUILD=DEBUG"
$(TARGET): $(OBJ_FILES)
@$(call create_dir,$(@D))
$(CC) $(LDFLAGS) -o $@ $^ $(CLIBS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@$(call create_dir,$(@D))
$(CC) -std=$(CSTD) -c $(CFLAGS) $(CINCLUDE) -o $@ $<
clean:
rm -rf $(OBJ_DIR)/*.o
.PHONY: all clean