-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
59 lines (42 loc) · 1.38 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
SHELL=cmd
CXX=g++
CDEFFLAGS=-std=c++20 -Wall -Wextra -Wpedantic -Wconversion
CDEBFLAGS=-g -O0 -D _DEBUG
CFLAGS=-O3 -Wl,--strip-all,--build-id=none,--gc-sections -fno-ident -mwindows -D NDEBUG -static -fno-rtti
LIB=-municode -ld2d1 -luuid -ldwrite -lgdi32 -lwinmm
SRC=src
OBJ=obj
DOBJ=obj.d
TARGET=SnakeD2D
default: debug
$(OBJ):
mkdir $(OBJ)
$(DOBJ):
mkdir $(DOBJ)
$(OBJ)/resource.rc.o: $(SRC)/resource.rc
windres -i $^ $@ -D NDEBUG
$(OBJ)/%.cpp.o: $(SRC)/%.cpp
$(CXX) -c $^ -o $@ $(CDEFFLAGS) $(CFLAGS)
$(DOBJ)/resource.rc.o: $(SRC)/resource.rc
windres -i $^ $@ -D _DEBUG
$(DOBJ)/%.cpp.o: $(SRC)/%.cpp
$(CXX) -c $^ -o $@ $(CDEFFLAGS) $(CDEBFLAGS)
srcs = $(wildcard $(SRC)/*.cpp)
srcs += $(wildcard $(SRC)/*.rc)
srcs := $(subst $(SRC)/,,$(srcs))
objs_d = $(srcs:%=$(DOBJ)/%.o)
objs_r = $(srcs:%=$(OBJ)/%.o)
debug_obj: $(objs_d)
$(CXX) $^ -o deb$(TARGET).exe $(CDEBFLAGS) $(LIB)
debug: $(DOBJ) debug_obj
release_obj: $(objs_r)
$(CXX) $^ -o $(TARGET).exe $(CFLAGS) $(LIB)
release: $(OBJ) release_obj
debbulk: $(DOBJ) bulkcompile.cpp $(DOBJ)/resource.rc.o
$(CXX) bulkcompile.cpp $(DOBJ)/resource.rc.o -o deb$(TARGET).exe $(CDEFFLAGS) $(CDEBFLAGS) $(LIB)
relbulk: $(OBJ) bulkcompile.cpp $(OBJ)/resource.rc.o
$(CXX) bulkcompile.cpp $(OBJ)/resource.rc.o -o $(TARGET).exe $(CDEFFLAGS) $(CFLAGS) $(LIB)
clean:
del *.exe
IF EXIST $(OBJ) rd /s /q $(OBJ)
IF EXIST $(DOBJ) rd /s /q $(DOBJ)