-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (33 loc) · 1019 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
39
40
41
42
43
CXX := g++
CXXFLAGS := -std=c++17 -DGLEW_STATIC -I ./ -fPIC
LDFLAGS :=
DLLFLAGS :=
ifeq ($(OS),Windows_NT)
LIBS := -lmingw32 -luser32 -lgdi32 -lshell32 -lglew32 -lglfw3 -lopengl32
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
LIBS := -lGLEW -lGL -lglfw -pthread
endif
ifeq ($(UNAME_S),Darwin)
LIBS := -L /opt/homebrew/lib -lGLEW -lglfw -framework CoreVideo -framework OpenGL -framework IOKit
CXXFLAGS := -std=c++17 -DGLEW_STATIC -I ./ -fPIC -I /opt/homebrew/include
endif
endif
ifeq ($(BUILD),RELEASE)
OPT := -O3
else
ifeq ($(BUILD),PROFILE)
OPT := -O3 -g
else
OPT := -g -DSCROLLS_DEBUG
endif
endif
sources := $(wildcard */*.cc)
headers := $(wildcard */*.h)
allobjects := $(patsubst %,obj/%, $(patsubst %.cc,%.o, $(sources)))
objects = $(foreach dir,$(1),$(patsubst %.cc,obj/%.o,$(wildcard $(dir)/*.cc)))
scrolls: $(call objects,base glgraphics threadpool)
$(CXX) $(CXXFLAGS) $(OPT) $^ -o scrolls $(LDFLAGS) $(LIBS)
$(allobjects): obj/%.o : %.cc $(headers)
$(CXX) $(CXXFLAGS) $(OPT) -c $< -o $@