33 lines
583 B
Makefile
33 lines
583 B
Makefile
# Detect OS
|
|
OS := $(shell uname)
|
|
|
|
GLEW_LIBS := $(shell pkgconf --libs glew)
|
|
GLFW_LIBS := $(shell pkgconf --libs glfw3)
|
|
|
|
# Set libraries for Linux
|
|
ifeq ($(OS), Linux)
|
|
OPENGL_LIB := -lGL
|
|
# Set libraries for Windows (MSYS2)
|
|
else
|
|
OPENGL_LIB := -lopengl32
|
|
endif
|
|
|
|
# Source files
|
|
SRC := src/main.c src/log.c src/shader.c src/matrix-math.c
|
|
|
|
# Output binary
|
|
OUT := cg1
|
|
|
|
# Compiler
|
|
CC := gcc
|
|
|
|
# Build target
|
|
$(OUT): $(SRC)
|
|
$(CC) -o $(OUT) $(SRC) $(GLEW_LIBS) $(GLFW_LIBS) $(OPENGL_LIB)
|
|
|
|
# Clean target
|
|
clean:
|
|
rm -f $(OUT)
|
|
|
|
# mark phony targets
|
|
.PHONY: clean |