-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (41 loc) · 1.17 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
# Directories
SRC_DIR = ./src
IMGUI_DIR = ./lib/imgui
OBJ_DIR = obj
# Compiler and flags
CC = g++
CFLAGS = -Wall -Wextra -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
LIBS = -lGL -lGLU -lglut -lglfw -lGLEW
# Source files
SRC = $(IMGUI_DIR)/imgui.cpp \
$(IMGUI_DIR)/imgui_draw.cpp \
$(IMGUI_DIR)/imgui_widgets.cpp \
$(IMGUI_DIR)/imgui_tables.cpp \
$(IMGUI_DIR)/imgui_demo.cpp \
$(IMGUI_DIR)/backends/imgui_impl_glfw.cpp \
$(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp \
$(SRC_DIR)/main.cpp \
$(SRC_DIR)/optimize.cpp \
$(SRC_DIR)/gui.cpp \
$(SRC_DIR)/threading.cpp
# Object files in the obj directory
OBJ = $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(SRC))
# Output executable
TARGET = gecko
# Default target (build and run the project)
all: $(TARGET)
@echo "Build successful. Running the program..."
@./$(TARGET)
# Rule to build the executable
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $(TARGET) $(LIBS)
# Rule to build object files in the obj directory
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
# Clean target
clean:
rm -f $(OBJ) $(TARGET)
rm -rf $(OBJ_DIR)
# Phony targets (not real files)
.PHONY: all clean