Makefile now detects OS.

This commit is contained in:
2026-02-14 11:20:27 -08:00
parent 084d4cc8b6
commit 1072c58e51
2 changed files with 28 additions and 10 deletions

View File

@@ -1,18 +1,36 @@
ifeq ($(OS),Windows_NT)
DETECTED_OS := windows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
DETECTED_OS := macos
else ifeq ($(UNAME_S),Linux)
DETECTED_OS := linux
else
DETECTED_OS := unknown
endif
endif
CC = clang
UFLAGS =
FLAGS = -Wall -Wextra -ggdb -fno-caret-diagnostics -fno-show-column
#-std=c99 -pedantic
# MacOS
ifeq ($(DETECTED_OS),macos)
INCLUDE = $(shell pkg-config --cflags raylib)
LIBS = $(shell pkg-config --libs raylib)
FRAMEWORKS = -framework IOKit -framework Cocoa -framework OpenGL
# Linux
# INCLUDE = -I./third_party/raylib/src/
# LIBS = ./third_party/raylib/src/libraylib.a -lm
# FRAMEWORKS =
else ifeq ($(DETECTED_OS),linux)
INCLUDE = -I./third_party/raylib/src/
LIBS = ./third_party/raylib/src/libraylib.a -lm
FRAMEWORKS =
else ifeq ($(DETECTED_OS),windows)
INCLUDE =
LIBS =
FRAMEWORKS =
endif
EXE=main