-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (36 loc) · 925 Bytes
/
Makefile
File metadata and controls
48 lines (36 loc) · 925 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
43
44
45
46
47
48
.PHONY: all clean run bin build
CXX= g++
CXXFLAGS= -Wall -std=c++17 -Iinclude
SFML_LIBS= -lsfml-graphics -lsfml-window -lsfml-system
ifeq ($(OS), Windows_NT)
EXE := .exe
RM := cmd /C del /Q /F
BUILD_FOLDER := if not exist build mkdir build
BIN_FOLDER := if not exist bin mkdir bin
CLEAN = $(RM) bin\\*.exe build\\*.o 2>nul >nul
RUN_CMD = $(TARGET)
else
EXE :=
RM := rm -f
BUILD_FOLDER := mkdir -p build
BIN_FOLDER := mkdir -p bin
CLEAN = $(RM) bin/*.exe build/*.o
RUN_CMD = ./$(TARGET)
endif
TARGET = bin/main$(EXE)
SRCS= $(wildcard demo/*.cpp)
OBJS= $(patsubst demo/%.cpp, build/%.o, $(SRCS))
all: $(TARGET)
$(TARGET): $(OBJS) | bin
@$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(SFML_LIBS)
build/%.o: demo/%.cpp | build
@$(CXX) $(CXXFLAGS) -c $< -o $@
bin:
@$(BIN_FOLDER)
build:
@$(BUILD_FOLDER)
clean:
@echo "Cleaning..."
@$(CLEAN)
run: $(TARGET)
@$(RUN_CMD)