-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
36 lines (27 loc) · 1.04 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
CC = g++
WINDOWS_COMPILER = x86_64-w64-mingw32-g++
FLAGS = -Wall -Wextra -Wno-missing-field-initializers -Wno-format-overflow -pedantic -lm -O3 -L ./raylib/linux/ -lraylib
WINDOWS_FLAGS = -Wall -Wextra -Wno-missing-field-initializers -Wno-format-overflow -pedantic -lm -O3 -L ./raylib/windows/ -lraylib -lgdi32 -lwinmm -lopengl32 -static
SRCDIR = src
OBJDIR = build/posix
WINOBJDIR = build/win32
SRC = $(wildcard $(SRCDIR)/*.cpp)
OBJ = $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRC))
WINOBJ = $(patsubst $(SRCDIR)/%.cpp, $(WINOBJDIR)/%.o, $(SRC))
# Default target for Linux
main: $(OBJ)
$(CC) $^ $(FLAGS) -o wireframe
# Windows target
win: $(WINOBJ)
$(WINDOWS_COMPILER) $^ $(WINDOWS_FLAGS) -o wireframe.exe
# Compile object files for Linux
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(OBJDIR)
$(CC) $(FLAGS) -c $< -o $@
# Compile object files for Windows
$(WINOBJDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(WINOBJDIR)
$(WINDOWS_COMPILER) $(WINDOWS_FLAGS) -c $< -o $@
# Clean all builds
clear:
@rm -f $(OBJDIR)/*.o $(WINOBJDIR)/*.o wireframe wireframe.exe