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
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