-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
executable file
·34 lines (26 loc) · 797 Bytes
/
Copy pathmakefile
File metadata and controls
executable file
·34 lines (26 loc) · 797 Bytes
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
COMPILER := g++
FLAGS := -std=c++20 -O2
INCLUDE_LIBS_FOLDER := -I/usr/local/include
LIBS := -pthread
TARGET := app
MAINFILE = main.cpp
OBJ := $(patsubst %.cpp, %.o, $(shell find src/ -name '*.cpp'))
all : $(TARGET)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
LIBS += -lGL -lGLEW -lglfw
endif
ifeq ($(UNAME_S), Darwin)
LIBS += -framework OpenGL -lGLEW -lglfw
FLAGS += -arch x86_64
endif
UNAME_P := $(shell uname -p)
%.o : %.cpp
@mkdir -p build bin
$(COMPILER) $(FLAGS) ${INCLUDE_LIBS_FOLDER} -c $< -o bin/$(notdir $@)
$(TARGET) : $(OBJ)
$(COMPILER) $(FLAGS) ${INCLUDE_LIBS_FOLDER} -c ${MAINFILE} -o bin/mainFile.o
$(COMPILER) ${FLAGS} ${INCLUDE_LIBS_FOLDER} bin/mainFile.o $(shell find bin -name '*.o') -o build/$@.$(UNAME_P) $(LIBS)
clean:
rm -f bin/*.o
rm -f build/*