-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (29 loc) · 1023 Bytes
/
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
SRCS = $(wildcard src/*.cpp)
OBJS = $(addprefix builds/, $(addsuffix .o, $(basename $(notdir $(SRCS)))))
EXE = builds/game # Final executable name
IMGUI_SRCS = $(wildcard src/includes/imgui/*.cpp) $(wildcard src/includes/imgui/backends/*.cpp)
IMGUI_OBJS = $(addprefix builds/, $(addsuffix .o, $(basename $(notdir $(IMGUI_SRCS)))))
IMGUI_DIR = includes/imgui/
IMGUI_FLAGS = -I$(IMGUI_DIR) -I$(IMGUI_DIR)backends `sdl2-config --cflags`
IMGUI_LIBS = -lGL -ldl `sdl2-config --libs`
CC = g++
COMPILER_FLAGS = -Wall -Wextra -std=c++20
LINKER_FLAGS = -lSDL2_ttf -lSDL2_image -llua5.4
all: build
build: $(OBJS) imgui
$(CC) $(OBJS) $(IMGUI_OBJS) $(COMPILER_FLAGS) $(IMGUI_LIBS) $(LINKER_FLAGS) -o $(EXE)
builds/%.o: src/%.cpp
$(CC) $(COMPILER_FLAGS) -c -o $@ $<
builds/%.o: $(IMGUI_DIR)/%.cpp
$(CC) $(IMGUI_FLAGS) -c -o $@ $<
builds/%.o: $(IMGUI_DIR)backends/%.cpp
$(CC) $(IMGUI_FLAGS) -c -o $@ $<
imgui: $(IMGUI_OBJS)
@echo IMGUI: COMPLETE
@echo
.PHONY : clean
clean:
rm $(OBJ_NAME)
.PHONY : run
run:
./$(OBJ_NAME)