CC      ?= cc
CFLAGS  ?= -O2 -Wall -Wextra
PKGCFG  := $(shell pkg-config --cflags --libs glfw3 2>/dev/null)

# Fallbacks if pkg-config has no glfw3 entry
ifeq ($(strip $(PKGCFG)),)
PKGCFG := -lglfw
endif

# OpenGL: Linux uses -lGL, macOS uses the framework
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
GL := -framework OpenGL
else
GL := -lGL
endif

vectordesert: main.c
	$(CC) $(CFLAGS) -o $@ main.c $(PKGCFG) $(GL) -lm

clean:
	rm -f vectordesert

.PHONY: clean
