Unified Makefile platform specifications
This commit is contained in:
parent
0dad34dc59
commit
4b903ad1a5
31
Makefile
31
Makefile
@ -1,29 +1,30 @@
|
|||||||
# Set platform-specific macros
|
# Set macros
|
||||||
|
buildFile = ./build/app
|
||||||
|
|
||||||
|
# Check for Windows
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
# Build for Windows
|
# Set Windows macros
|
||||||
libPath = ./lib/Windows/libraylib_static.a
|
platform = Windows
|
||||||
buildfile = ./build/app
|
compiler = g++
|
||||||
compileCommand = g++ -std=c++17 -I ./include/ -L./lib/Windows ./src/main.cpp -o $(buildfile) -lraylib -pthread -lopengl32 -lgdi32 -lwinmm -mwindows
|
options = -p thread -l opengl32 -l gdi32 -l winmm -m windows
|
||||||
else
|
else
|
||||||
# Build for MacOS/Linux
|
# Check for MacOS/Linux
|
||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S), Linux)
|
ifeq ($(UNAME_S), Linux)
|
||||||
# Set Linux macros
|
# Set Linux macros
|
||||||
|
platform = Linux
|
||||||
compiler = g++
|
compiler = g++
|
||||||
libPath = ./lib/Linux/libraylib.a
|
options = # None
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S), Darwin)
|
ifeq ($(UNAME_S), Darwin)
|
||||||
# Set macOS macros
|
# Set macOS macros
|
||||||
|
platform = macOS
|
||||||
compiler = clang++
|
compiler = clang++
|
||||||
frameworks = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
|
options = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
|
||||||
libPath = ./lib/macOS/libraylib.a
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
buildfile = ./build/app
|
|
||||||
initCommand = mkdir -p build
|
initCommand = mkdir -p build
|
||||||
compileCommand = $(compiler) -std=c++17 $(frameworks) -I ./include/ $(libPath) ./src/main.cpp -o $(buildfile)
|
cleanCommand = rm $(buildFile)
|
||||||
cleanCommand = rm $(buildfile)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: init compile run clean
|
all: init compile run clean
|
||||||
@ -32,10 +33,10 @@ init:
|
|||||||
$(initCommand)
|
$(initCommand)
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
$(compileCommand)
|
$(compiler) -std=c++17 -I ./include/ -L ./lib/$(platform) ./src/main.cpp -o $(buildFile) -l raylib $(options)
|
||||||
|
|
||||||
run:
|
run:
|
||||||
$(buildfile)
|
$(buildFile)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(cleanCommand)
|
$(cleanCommand)
|
||||||
|
Loading…
Reference in New Issue
Block a user