-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (45 loc) · 1.57 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
all: build
CFLAGS := *.c -lm -L../lib ../lib/libraylib.a -I../lib/ -Os
this_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown OS')
target ?= $(this_OS)
ifeq ($(target),Linux)
CFLAGS += -lraylib -lGL -lm -lpthread -ldl -lrt -o ../cnake
endif
ifeq ($(target),Darwin)
CFLAGS += -lraylib -framework CoreVideo -framework IOKit -framework Cocoa -framework OpenGL -o ../cnake
endif
ifeq ($(target),Windows_NT)
CFLAGS += -lraylib -lopengl32 -lgdi32 -lwinmm -mwindows -o ../cnake.exe
endif
ifeq ($(target),Windows_NT)
compiler := x86_64-w64-mingw32-gcc
else
compiler := gcc
endif
fetch_raylib:
ifeq ($(target),Linux)
wget -q https://github.com/raysan5/raylib/releases/download/5.0/raylib-5.0_linux_amd64.tar.gz
tar -xf ./raylib-5.0_linux_amd64.tar.gz
mv ./raylib-5.0_linux_amd64 ./raylib
rm ./raylib-5.0_linux_amd64.tar.gz
endif
ifeq ($(target),Darwin)
wget -q https://github.com/raysan5/raylib/releases/download/5.0/raylib-5.0_macos.tar.gz
tar -xf ./raylib-5.0_macos.tar.gz
mv ./raylib-5.0_macos ./raylib
rm ./raylib-5.0_macos.tar.gz
endif
ifeq ($(target),Windows_NT)
wget -q https://github.com/raysan5/raylib/releases/download/5.0/raylib-5.0_win64_mingw-w64.zip
unzip -qq raylib-5.0_win64_mingw-w64.zip
mv ./raylib-5.0_win64_mingw-w64 ./raylib
rm ./raylib-5.0_win64_mingw-w64.zip
endif
mv ./raylib/lib/libraylib.a ./lib/
mv ./raylib/include/raylib.h ./lib/
rm -rf ./raylib
build:
([ ! -e ./lib/libraylib.a ] || [ ! -e ./lib/raylib.h ]) && $(MAKE) fetch_raylib || :
(cd src && $(compiler) $(CFLAGS))
clean:
([ -f lib/libraylib.a ] || [ -f lib/raylib.h ]) && rm ./lib/* || :