2020-02-26 23:14:24 +00:00
|
|
|
CFLAGS := -O2 -s
|
2020-02-27 17:01:34 +00:00
|
|
|
LDFLAGS := -O2 -s -lm
|
2020-02-26 23:14:24 +00:00
|
|
|
|
|
|
|
AR ?= ar
|
2020-03-30 18:59:44 +00:00
|
|
|
LUA ?= luajit/src/luajit
|
2020-02-26 23:14:24 +00:00
|
|
|
|
2020-05-10 11:43:22 +00:00
|
|
|
WINDRES ?= windres
|
|
|
|
|
2021-10-24 11:16:32 +00:00
|
|
|
CFLAGS += -Iluajit/src -Iraylib/src -Iraygui/src
|
2020-12-21 12:42:18 +00:00
|
|
|
LDFLAGS += luajit/src/libluajit.a raylib/src/libraylib.a
|
2020-02-27 17:01:34 +00:00
|
|
|
|
2020-03-31 19:43:33 +00:00
|
|
|
MODULES := raymath rlgl easings gestures physac raygui
|
2020-03-01 19:09:56 +00:00
|
|
|
|
2020-10-07 10:40:58 +00:00
|
|
|
# raylib settings
|
|
|
|
PLATFORM ?= PLATFORM_DESKTOP
|
2021-10-24 11:16:32 +00:00
|
|
|
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
|
|
|
|
2022-03-18 11:54:42 +00:00
|
|
|
CFLAGS += -D$(GRAPHICS) -D$(PLATFORM)
|
2020-10-07 10:40:58 +00:00
|
|
|
|
|
|
|
USE_WAYLAND_DISPLAY ?= FALSE
|
|
|
|
USE_EXTERNAL_GLFW ?= FALSE
|
|
|
|
|
2020-02-27 17:01:34 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2020-02-27 22:15:10 +00:00
|
|
|
LDFLAGS += -lopengl32 -lgdi32 -lwinmm -static
|
2020-05-10 11:43:22 +00:00
|
|
|
EXTERNAL_FILES := src/res/icon.res
|
2020-04-01 11:15:42 +00:00
|
|
|
else ifeq ($(shell uname),Darwin)
|
2020-05-10 11:43:22 +00:00
|
|
|
LDFLAGS += -framework CoreVideo -framework IOKit -framework Cocoa \
|
|
|
|
-framework GLUT -framework OpenGL \
|
|
|
|
-Wl,-pagezero_size,10000,-image_base,100000000
|
|
|
|
EXTERNAL_FILES :=
|
2020-03-29 13:41:54 +00:00
|
|
|
else
|
2020-10-07 10:40:58 +00:00
|
|
|
LDFLAGS += -ldl -lpthread
|
|
|
|
ifeq ($(PLATFORM),PLATFORM_DRM)
|
|
|
|
LDFLAGS += -ldrm -lGLESv2 -lEGL -lgbm
|
|
|
|
else
|
|
|
|
LDFLAGS += -lX11
|
|
|
|
endif
|
2020-05-10 11:43:22 +00:00
|
|
|
EXTERNAL_FILES :=
|
2020-02-27 17:01:34 +00:00
|
|
|
endif
|
|
|
|
|
2022-03-18 11:54:42 +00:00
|
|
|
all: raylua_s raylua_e raylua_r luajit raylib
|
2020-02-26 23:14:24 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
|
2020-02-27 17:01:34 +00:00
|
|
|
luajit:
|
2020-10-07 10:40:58 +00:00
|
|
|
$(MAKE) -C luajit amalg \
|
|
|
|
CC=$(CC) BUILDMODE=static \
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.13
|
2020-02-27 17:01:34 +00:00
|
|
|
|
|
|
|
raylib:
|
2020-10-07 10:40:58 +00:00
|
|
|
$(MAKE) -C raylib/src \
|
|
|
|
CC=$(CC) AR=$(AR) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
|
|
|
|
USE_WAYLAND_DISPLAY="$(USE_WAYLAND_DISPLAY)" \
|
|
|
|
USE_EXTERNAL_GLFW="$(USE_EXTERNAL_GLFW)" \
|
|
|
|
PLATFORM="$(PLATFORM)" GRAPHICS="$(GRAPHICS)"
|
|
|
|
|
2020-02-27 17:01:34 +00:00
|
|
|
|
2020-05-10 11:43:22 +00:00
|
|
|
raylua_s: src/raylua_s.o $(EXTERNAL_FILES) libraylua.a
|
2020-04-01 11:15:42 +00:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS) luajit/src/libluajit.a
|
2020-02-26 23:14:24 +00:00
|
|
|
|
2020-05-10 11:43:22 +00:00
|
|
|
raylua_e: src/raylua_e.o src/raylua_self.o src/raylua_builder.o src/lib/miniz.o \
|
|
|
|
$(EXTERNAL_FILES) libraylua.a
|
2020-04-01 11:15:42 +00:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS) luajit/src/libluajit.a
|
2020-02-26 23:14:24 +00:00
|
|
|
|
2022-03-18 11:54:42 +00:00
|
|
|
raylua_r: src/raylua_e.o src/raylua_self.o src/raylua_builder.o src/lib/miniz.o \
|
|
|
|
$(EXTERNAL_FILES) libraylua.a
|
|
|
|
$(CC) -o $@ $^ $(LDFLAGS) -mwindows luajit/src/libluajit.a
|
|
|
|
|
2020-05-10 11:43:22 +00:00
|
|
|
src/res/icon.res: src/res/icon.rc
|
|
|
|
$(WINDRES) $^ -O coff $@
|
|
|
|
|
2020-04-30 20:00:21 +00:00
|
|
|
libraylua.a: src/raylua.o
|
|
|
|
$(AR) rcu $@ $^
|
|
|
|
|
2020-03-08 14:16:50 +00:00
|
|
|
raylua.dll: src/raylua.o
|
2020-08-19 14:58:45 +00:00
|
|
|
$(CC) -shared -fPIE -o $@ $^ $(LDFLAGS) -llua5.1
|
2020-03-08 14:16:50 +00:00
|
|
|
|
2020-03-31 19:33:13 +00:00
|
|
|
raylua.so: src/raylua.o
|
2020-09-05 13:47:37 +00:00
|
|
|
$(CC) -shared -fPIE -o $@ $^ $(LDFLAGS) -llua5.1
|
2020-03-31 19:33:13 +00:00
|
|
|
|
2020-02-27 17:38:21 +00:00
|
|
|
src/raylua.o: luajit raylib src/autogen/boot.c src/autogen/bind.c
|
2020-02-27 17:01:34 +00:00
|
|
|
|
|
|
|
src/raylua_builder.o: src/autogen/builder.c
|
|
|
|
|
2020-05-08 15:07:34 +00:00
|
|
|
src/autogen/boot.c: src/raylib.lua src/compat.lua src/raylua.lua
|
2020-02-27 17:01:34 +00:00
|
|
|
$(LUA) tools/lua2str.lua $@ raylua_boot_lua $^
|
|
|
|
|
|
|
|
src/autogen/bind.c:
|
2020-03-01 19:09:56 +00:00
|
|
|
$(LUA) tools/genbind.lua $@ $(MODULES)
|
2020-02-27 17:01:34 +00:00
|
|
|
|
|
|
|
src/autogen/builder.c: src/raylua_builder.lua
|
|
|
|
$(LUA) tools/lua2str.lua $@ raylua_builder_lua $^
|
2020-02-26 23:14:24 +00:00
|
|
|
|
|
|
|
clean:
|
2020-05-10 11:43:22 +00:00
|
|
|
rm -rf raylua_s raylua_e libraylua.a src/raylua_e.o src/raylua_s.o \
|
|
|
|
src/raylua.o src/raylua_self.o src/raylua_builder.o src/autogen/*.c \
|
2020-12-29 13:03:13 +00:00
|
|
|
src/lib/miniz.o src/res/icon.res
|
2020-02-27 17:01:34 +00:00
|
|
|
$(MAKE) -C luajit clean
|
2020-02-27 22:15:10 +00:00
|
|
|
$(MAKE) -C raylib/src clean
|
2020-10-07 10:40:58 +00:00
|
|
|
rm -f raylib/libraylib.a
|
2020-02-26 23:14:24 +00:00
|
|
|
|
2020-05-10 11:43:22 +00:00
|
|
|
.PHONY: all src/autogen/bind.c src/autogen/boot.c raylua_s raylua_e luajit \
|
|
|
|
raylib clean
|