-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (33 loc) · 1.47 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
PROGNAME = buddha.out
SRCDIR = src/
OBJDIR = obj/
INCDIR = include/
SRC = $(wildcard $(SRCDIR)*.cpp)
CC = g++ -std=c++17
WARNFLAGS = -Wall -Wno-deprecated-declarations -Wno-writable-strings
CFLAGS = -g -O3 $(WARNFLAGS) -MD -Iinclude/ -I./ -Iimgui/ -Iimplot/ -Iimgui/backends/ -I/usr/local/include -I/opt/homebrew/Cellar/glfw/3.3.8/include
LDFLAGS =-framework opencl -framework OpenGL -L/opt/homebrew/Cellar/glfw/3.3.8/lib -lglfw
# Do some substitution to get a list of .o files from the given .cpp files.
OBJFILES = $(patsubst $(SRCDIR)%.cpp, $(OBJDIR)%.o, $(SRC))
INCFILES = $(patsubst $(SRCDIR)%.cpp, $(INCDIR)%.hpp, $(SRC))
IMGUI_DIR = imgui/
IMGUI_SRC = $(IMGUI_DIR)imgui.cpp $(IMGUI_DIR)imgui_draw.cpp $(IMGUI_DIR)imgui_tables.cpp $(IMGUI_DIR)imgui_widgets.cpp
IMGUI_SRC += $(IMGUI_DIR)backends/imgui_impl_glfw.cpp $(IMGUI_DIR)backends/imgui_impl_opengl2.cpp
IMGUI_OBJ = $(patsubst $(IMGUI_DIR)%.cpp, $(OBJDIR)%.o, $(IMGUI_SRC))
IMPLOT_DIR = implot/
IMPLOT_SRC = $(IMPLOT_DIR)implot.cpp $(IMPLOT_DIR)implot_items.cpp
IMPLOT_OBJ = $(patsubst $(IMPLOT_DIR)%.cpp, $(OBJDIR)%.o, $(IMPLOT_SRC))
.PHONY: all clean
all: $(PROGNAME)
$(PROGNAME): $(OBJFILES) $(IMGUI_OBJ) $(IMPLOT_OBJ)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(OBJDIR)%.o: $(SRCDIR)%.cpp
$(CC) -c $(CFLAGS) -o $@ $<
$(OBJDIR)%.o: $(IMGUI_DIR)%.cpp
$(CC) -c $(CFLAGS) -o $@ $<
$(OBJDIR)%.o: $(IMPLOT_DIR)%.cpp
$(CC) -c $(CFLAGS) -o $@ $<
clean:
rm -fv $(PROGNAME) $(OBJFILES)
rm -fv $(OBJDIR)*.d
-include $(OBJFILES:.o=.d)