From e02caa69bd4161f5dcf04b6cebada15a49a2f6bd Mon Sep 17 00:00:00 2001 From: Jonathan Moallem Date: Fri, 20 Nov 2020 05:48:24 +0000 Subject: [PATCH] Added Linux case to Makefile --- Makefile | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index c7facab..43ad879 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,26 @@ -# Variable definitions -macOSFrameworks = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL - +# Set platform-specific macros ifeq ($(OS), Windows_NT) - # Build for Windows: - - # Not implemented yet + # Build for Windows + else - # Build for MacOS or Linux: + # Build for MacOS/Linux + + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S), Linux) + # Set Linux macros + compiler = g++ + libPath = ./lib/Linux/libraylib.a + endif + ifeq ($(UNAME_S), Darwin) + # Set macOS macros + compiler = clang++ + frameworks = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL + libPath = ./lib/macOS/libraylib.a + endif + buildfile = ./build/app initCommand = mkdir -p build - compileCommand = clang++ -std=c++17 $(macOSFrameworks) -I ./include/ ./lib/libraylib.a ./src/main.cpp -o $(buildfile) + compileCommand = $(compiler) -std=c++17 $(frameworks) -I ./include/ $(libPath) ./src/main.cpp -o $(buildfile) cleanCommand = rm $(buildfile) endif @@ -25,4 +36,4 @@ run: $(buildfile) clean: - $(cleanCommand) \ No newline at end of file + $(cleanCommand)