-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
81 lines (59 loc) · 2.14 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
CFLAGS := -O2 -s
LDFLAGS := -O2 -s -lm
AR ?= ar
LUA ?= luajit
CFLAGS += -Iinclude -Iwren/src/include -Iraylib/src
LDFLAGS += -Lwren/lib -L. -lwren -Lraylib -Lraylib/src -lraylib
# wray settings
CFLAGS += -DWRAY_TYPE_CHECK -D_DEFAULT_SOURCE
# raylib settings
PLATFORM ?= PLATFORM_DESKTOP
GRAPHICS ?= GRAPHICS_API_OPENGL_33
CFLAGS += -D$(PLATFORM) -D$(GRAPHICS)
USE_WAYLAND_DISPLAY ?= FALSE
USE_EXTERNAL_GLFW ?= FALSE
ifneq ($(PLATFORM),PLATFORM_WEB)
ifeq ($(OS),Windows_NT)
LDFLAGS += -lopengl32 -lgdi32 -lwinmm -static
else ifeq ($(shell uname),Darwin)
LDFLAGS += -framework CoreVideo -framework IOKit -framework Cocoa \
-framework GLUT -framework OpenGL \
-Wl,-pagezero_size,10000,-image_base,100000000
else
LDFLAGS += -ldl -lX11 -lpthread
endif
endif
WRAY_API := api/Raylib.wren api/Color.wren api/Key.wren api/Math.wren \
api/Audio.wren api/Structures.wren api/World.wren
SRC := src/wray.c src/wray_funcs.c src/wray_api.c src/wray_typecheck.c \
src/wray_core.c src/wray_color.c src/wray_class.c src/wray_draw.c \
src/wray_image.c src/wray_audio.c src/wray_shader.c
OBJ := $(SRC:.c=.o)
all: libraylib.a libwren.a libwray.a wray_s wray_e
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
libwren.a: wren
$(MAKE) -C wren CC=$(CC) AR=$(AR)
libraylib.a:
$(MAKE) CC=$(CC) AR=$(AR) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
USE_WAYLAND_DISPLAY="$(USE_WAYLAND_DISPLAY)" \
USE_EXTERNAL_GLFW="$(USE_EXTERNAL_GLFW)" \
PLATFORM="$(PLATFORM)" GRAPHICS="$(GRAPHICS)" \
-C raylib/src
libwray.a: $(OBJ)
$(AR) rcu $@ $^
src/wray_api.c: $(WRAY_API)
$(LUA) tools/wren2str.lua $@ wray_api $^
wray.js: libwray.a src/lib/miniz.o src/wray_w.o
$(CC) -o $@ $^ -lwray $(LDFLAGS) -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s FETCH=1 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH=1
wray_s: libwray.a src/wray_s.o
$(CC) -o $@ $^ -lwray $(LDFLAGS)
wray_e: libwray.a src/lib/miniz.o src/wray_builder.o src/wray_e.o
$(CC) -o $@ $^ -lwray $(LDFLAGS)
clean:
rm -rf src/wray_api.c src/wray_builder.o \
wray_s src/wray_s.o src/lib/miniz.o \
libwray.a $(OBJ) wray_e src/wray_e.o
$(MAKE) -C wren clean
$(MAKE) -C raylib/src clean
.PHONY: libwray.a wray_s wray_e