-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile_Windows
More file actions
60 lines (49 loc) · 1.92 KB
/
Copy pathMakefile_Windows
File metadata and controls
60 lines (49 loc) · 1.92 KB
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
59
60
########################################################################
####################### Makefile Template ##############################
########################################################################
SDL2_DIR = SDL2-devel-2.32.10-mingw/SDL2-2.32.10/x86_64-w64-mingw32
SDL2IMAGE_DIR = SDL2_image-devel-2.8.10-mingw/SDL2_image-2.8.10/x86_64-w64-mingw32
SDL2NET_DIR = SDL2_net-devel-2.2.0-mingw/SDL2_net-2.2.0/x86_64-w64-mingw32
SDL2MIXER_DIR = SDL2_mixer-devel-2.8.1-mingw/SDL2_mixer-2.8.1/x86_64-w64-mingw32
# Compiler settings - Can be customized.
CC = x86_64-w64-mingw32-gcc \
-L$(SDL2_DIR)/lib \
-I$(SDL2_DIR)/include \
-I$(SDL2_DIR)/include/SDL2 \
-L$(SDL2IMAGE_DIR)/lib \
-I$(SDL2IMAGE_DIR)/include \
-L$(SDL2NET_DIR)/lib \
-I$(SDL2NET_DIR)/include \
-L$(SDL2MIXER_DIR)/lib \
-I$(SDL2MIXER_DIR)/include \
CXXFLAGS = -std=c17 -Wall -Wextra -g -O3
LDFLAGS = -lmingw32 -mwindows -lSDL2main -lSDL2 -lSDL2_image -lSDL2_net -lSDL2_mixer -lssp -lm
# Makefile settings - Can be customized.
APPNAME = build_windows/Multris
EXT = .c
SRCDIR = src
OBJDIR = win_obj
SRC = $(wildcard $(SRCDIR)/*$(EXT))
OBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)/%.o)
# UNIX-based OS variables & settings
RM = rm
DELOBJ = $(OBJ)
# Windows OS variables & settings
DEL = del
EXE = .exe
WDELOBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)\\%.o)
########################################################################
####################### Targets beginning here #########################
########################################################################
$(shell mkdir -p $(OBJDIR))
all: $(APPNAME)
rm -rf $(OBJDIR)
# Builds the app
$(APPNAME): $(OBJ)
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
# Creates the dependecy rules
%.d: $(SRCDIR)/%$(EXT)
@$(CPP) $(CFLAGS) $< -MM -MT $(@:%.d=$(OBJDIR)/%.o) >$@
# Building rule for .o files and its .c/.cpp in combination with all .h
$(OBJDIR)/%.o: $(SRCDIR)/%$(EXT)
$(CC) $(CXXFLAGS) -o $@ -c $<