diff --git a/Makefile b/Makefile index df3e4ef..96d08bc 100644 --- a/Makefile +++ b/Makefile @@ -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 -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 = +ifeq ($(DETECTED_OS),macos) + INCLUDE = $(shell pkg-config --cflags raylib) + LIBS = $(shell pkg-config --libs raylib) + FRAMEWORKS = -framework IOKit -framework Cocoa -framework OpenGL +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 diff --git a/main.c b/main.c index 5084a41..d4459fe 100644 --- a/main.c +++ b/main.c @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) } } - if (fflush(f) != 0) + if(fflush(f) != 0) perror("fflush"); last_save = now_s;