Cleaned up Makefile and ignored clean target del for Windows

This commit is contained in:
Jonathan Moallem 2020-11-30 15:06:39 +11:00
parent d533475df5
commit c8a4c1a8b4

View File

@ -1,29 +1,33 @@
# Set general macros # Set general macros
buildFile = build/app buildFile = build/app
libGenDirectory = src
# Check for Windows # Check for Windows
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
# Set Windows compile macros # Set Windows macros
platform = Windows platform = Windows
compiler = g++ compiler = g++
options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows options = -pthread -lopengl32 -lgdi32 -lwinmm -mwindows
THEN = &&
else else
# Check for MacOS/Linux # Check for MacOS/Linux
UNAMEOS = $(shell uname) UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS), Linux) ifeq ($(UNAMEOS), Linux)
# Set Linux compile macros # Set Linux macros
platform = Linux platform = Linux
compiler = g++ compiler = g++
options = -l GL -l m -l pthread -l dl -l rt -l X11 options = -l GL -l m -l pthread -l dl -l rt -l X11
libGenDirectory = # Empty libGenDirectory = # Empty
endif endif
ifeq ($(UNAMEOS), Darwin) ifeq ($(UNAMEOS), Darwin)
# Set macOS compile macros # Set macOS macros
platform = macOS platform = macOS
compiler = clang++ compiler = clang++
options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
libGenDirectory = src
endif endif
# Set UNIX macros
THEN = ;
endif endif
# Explicitly set compiler to platform default if unset # Explicitly set compiler to platform default if unset
@ -48,24 +52,21 @@ submodules:
include: submodules include: submodules
ifeq ($(platform), Windows) ifeq ($(platform), Windows)
-mkdir .\include -mkdir .\include
-robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raylib.h -robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raylib.h raymath.h
-robocopy "vendor\raylib-cpp\vendor\raylib\src" "include" raymath.h
-robocopy "vendor\raylib-cpp\include" "include" *.hpp -robocopy "vendor\raylib-cpp\include" "include" *.hpp
else else
mkdir -p include mkdir -p include
cp vendor/raylib-cpp/vendor/raylib/src/raylib.h include/raylib.h cp vendor/raylib-cpp/vendor/raylib/src/{raylib.h,raymath.h} include
cp vendor/raylib-cpp/vendor/raylib/src/raymath.h include/raymath.h
cp vendor/raylib-cpp/include/*.hpp include cp vendor/raylib-cpp/include/*.hpp include
endif endif
# Build the raylib static library file and copy it into lib # Build the raylib static library file and copy it into lib
lib: submodules lib: submodules
cd vendor/raylib-cpp/vendor/raylib/src $(THEN) "$(MAKE)" PLATFORM=PLATFORM_DESKTOP
ifeq ($(platform), Windows) ifeq ($(platform), Windows)
cd vendor/raylib-cpp/vendor/raylib/src && "$(MAKE)" PLATFORM=PLATFORM_DESKTOP
-mkdir lib\$(platform) -mkdir lib\$(platform)
-robocopy "vendor\raylib-cpp\vendor\raylib\src" "lib\Windows" libraylib.a -robocopy "vendor\raylib-cpp\vendor\raylib\src" "lib\Windows" libraylib.a
else else
cd vendor/raylib-cpp/vendor/raylib/src; $(MAKE) PLATFORM=PLATFORM_DESKTOP
mkdir -p lib/$(platform) mkdir -p lib/$(platform)
cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a cp vendor/raylib-cpp/vendor/raylib/$(libGenDirectory)/libraylib.a lib/$(platform)/libraylib.a
endif endif
@ -89,9 +90,7 @@ execute:
# Clean up all relevant files # Clean up all relevant files
clean: clean:
ifeq ($(platform), Windows) ifeq ($(platform), Windows)
dir -del build\app.exe
dir build
erase build
else else
rm $(buildFile) rm $(buildFile)
endif endif