From c8a4c1a8b4a65d69bce5c315609e8ef2102830ba Mon Sep 17 00:00:00 2001 From: Jonathan Moallem Date: Mon, 30 Nov 2020 15:06:39 +1100 Subject: [PATCH] Cleaned up Makefile and ignored clean target del for Windows --- Makefile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index c497991..e66d731 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,33 @@ # Set general macros buildFile = build/app -libGenDirectory = src # Check for Windows ifeq ($(OS), Windows_NT) - # Set Windows compile macros + # Set Windows macros platform = Windows compiler = g++ options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows + THEN = && else # Check for MacOS/Linux UNAMEOS = $(shell uname) ifeq ($(UNAMEOS), Linux) - # Set Linux compile macros + # Set Linux macros platform = Linux compiler = g++ options = -l GL -l m -l pthread -l dl -l rt -l X11 libGenDirectory = # Empty endif ifeq ($(UNAMEOS), Darwin) - # Set macOS compile macros + # Set macOS macros platform = macOS compiler = clang++ options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL + libGenDirectory = src endif + + # Set UNIX macros + THEN = ; endif # Explicitly set compiler to platform default if unset @@ -48,24 +52,21 @@ submodules: include: submodules ifeq ($(platform), Windows) -mkdir .\include - -robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raylib.h - -robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raymath.h + -robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raylib.h raymath.h -robocopy "vendor\raylib-cpp\include" "include" *.hpp else mkdir -p include - cp vendor/raylib-cpp/vendor/raylib/src/raylib.h include/raylib.h - cp vendor/raylib-cpp/vendor/raylib/src/raymath.h include/raymath.h + cp vendor/raylib-cpp/vendor/raylib/src/{raylib.h,raymath.h} include cp vendor/raylib-cpp/include/*.hpp include endif # Build the raylib static library file and copy it into lib lib: submodules + cd vendor/raylib-cpp/vendor/raylib/src $(THEN) "$(MAKE)" PLATFORM=PLATFORM_DESKTOP ifeq ($(platform), Windows) - cd vendor/raylib-cpp/vendor/raylib/src && "$(MAKE)" PLATFORM=PLATFORM_DESKTOP -mkdir lib\$(platform) -robocopy "vendor\raylib-cpp\vendor\raylib\src" "lib\Windows" libraylib.a else - cd vendor/raylib-cpp/vendor/raylib/src; $(MAKE) PLATFORM=PLATFORM_DESKTOP mkdir -p lib/$(platform) cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a endif @@ -89,9 +90,7 @@ execute: # Clean up all relevant files clean: ifeq ($(platform), Windows) - dir - dir build - erase build + -del build\app.exe else rm $(buildFile) endif