-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (22 loc) · 762 Bytes
/
Makefile
File metadata and controls
30 lines (22 loc) · 762 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
TARGET = cb-control
CXX = C:\msys64\mingw64\bin\g++.exe
CXXFLAGS = -g -pedantic -Wall -Wextra -Wno-sign-compare -std=c++20
SRCDIR = src
OBJDIR = obj
LDFLAGS = -g
LDLIBS = -LC:\MinGW\lib -lws2_32
INC=-Isrc
RM = del /f
MKDIR = powershell.exe 'md -Force $(1) | Out-Null'
FIND = powershell.exe 'Get-ChildItem -Filter $(2) -Recurse $(1) | Resolve-Path -Relative | %{ $$_ -replace "\.\\", "" -replace "\\", "/" }'
SOURCES = $(shell $(call FIND,$(SRCDIR),*.cpp))
OBJECTS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SOURCES))
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(call MKDIR,$(dir $@))
$(CXX) $(CXXFLAGS) $(INC) -c $< -o $@
clean:
rd /s /q $(OBJDIR)