sources = \
	src/main.cpp \
	src/glstate.cpp \
	src/mesh.cpp \
	src/util.cpp \
	src/camera.cpp \
	src/scene.cpp \
	src/gl_core_3_3.c
inc = \
	-Iinclude
outname = base_glfw

UNAME := $(shell uname)

ifeq ($(UNAME),Darwin)
# macOS: GLFW and GLM come from Homebrew (brew install glfw glm)
brewprefix := $(shell brew --prefix 2>/dev/null)
inc += -I$(brewprefix)/include
libs = -L$(brewprefix)/lib -lglfw \
	-framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
cxxflags = -DGL_SILENCE_DEPRECATION
else
# Linux
libs = -lGL -lglfw
cxxflags =
endif

all:
	g++ -std=c++17 $(cxxflags) $(sources) $(libs) $(inc) -o $(outname)
clean:
	rm -f $(outname)
