raylib-lua-legacy/makefile

61 lines
1.4 KiB
Makefile
Raw Normal View History

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
LUA ?= luajit
2020-02-27 17:01:34 +00:00
CFLAGS += -Iluajit/src -Iraylib/src
LDFLAGS += -Lluajit/src -lluajit -Lraylib/src -lraylib
MODULES := rlgl physac
2020-02-27 17:01:34 +00:00
ifeq ($(OS),Windows_NT)
LDFLAGS += -lopengl32 -lgdi32 -lwinmm -static
2020-03-29 13:41:54 +00:00
else
LDFLAGS += -ldl -lX11 -lpthread
2020-02-27 17:01:34 +00:00
endif
2020-02-26 23:14:24 +00:00
BOOT_FILES := src/raylib.lua src/raylua.lua
all: raylua_s raylua_e
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
2020-02-27 17:38:21 +00:00
all: raylua_s raylua_e luajit raylib
2020-02-27 17:01:34 +00:00
luajit:
$(MAKE) -C luajit amalg BUILDMODE=static
raylib:
$(MAKE) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" -C raylib/src
raylua_s: src/raylua.o src/raylua_s.o
$(CC) -o $@ $^ $(LDFLAGS)
2020-02-26 23:14:24 +00:00
2020-02-27 17:01:34 +00:00
raylua_e: src/raylua.o src/raylua_e.o src/raylua_builder.o src/lib/miniz.o
2020-02-26 23:14:24 +00:00
$(CC) -o $@ $^ $(LDFLAGS)
raylua.dll: src/raylua.o
$(CC) -shared -fPIE -o $@ $^ $(LDFLAGS)
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
src/autogen/boot.c: src/raylib.lua src/raylua.lua
$(LUA) tools/lua2str.lua $@ raylua_boot_lua $^
src/autogen/bind.c:
$(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:
rm -rf raylua_s raylua_e src/raylua_e.o src/raylua_s.o src/raylua.o src/autogen/*.c src/lib/miniz.o
2020-02-27 17:01:34 +00:00
$(MAKE) -C luajit clean
$(MAKE) -C raylib/src clean
2020-02-26 23:14:24 +00:00
2020-02-27 17:01:34 +00:00
.PHONY: all src/autogen/bind.c src/autogen/boot.c raylua_s raylua_e luajit raylib clean