NAME=luafar3
LUAVER=51
LUA=$(WINE_CMD)$(strip $(call os_name, luasdk/32/lua.exe))

SRCS = \
	luafar/bit64.c \
	luafar/exported.c \
	luafar/flags.c \
	luafar/keysandcolors.c \
	luafar/lflua.c \
	luafar/lregex.c \
	luafar/luamacro.c \
	luafar/lusercontrol.c \
	luafar/reg.c \
	luafar/service.c \
	luafar/slnunico.c \
	luafar/lutf8lib.c \
	luafar/uliolib$(LUAVER).c \
	luafar/uloadlib$(LUAVER).c \
	luafar/ustring.c \
	luafar/util.c \
	luafar/win.c \

ifeq ($(LUAVER),52)
SRCS += luafar/compat52.c
endif

USERLIBS = \
	luasdk/$(DIRBIT)/lua$(LUAVER).lib \
	-Wl,--out-implib,$(OBJDIR)/luafar3.lib \

USERC = \
	-Iluasdk/include \
	-DBUILD_DLL \
	-DWINVER=0x500 \
	-DLUADLL=\"lua$(LUAVER).dll\" \
	-Wno-cast-function-type \
	-Wno-cast-qual \
	-Wno-format-nonliteral \
	-Wno-implicit-fallthrough \
	-Wno-missing-declarations \

ifdef CLANG
USERC += \
	-Wno-bad-function-cast \
	-Wno-cast-align \
	-Wno-comma \
	-Wno-conditional-uninitialized \
	-Wno-float-equal \
	-Wno-format-non-iso \
	-Wno-missing-prototypes \
	-Wno-missing-variable-declarations \
	-Wno-pedantic \
	-Wno-shadow \
	-Wno-strict-prototypes \
	-Wno-unused-macros \

endif

RC_NAME = luafar/$(NAME)
DEF_NAME = -

include ../makefile_gcc_def_inc

DOCS = \
	luasdk/$(DIRBIT)/lua$(LUAVER).dll \
	luasdk/$(DIRBIT)/lpeg.dll \

include ../makefile_gcc_target_inc

luafar/flags.c: $(COMINC)/plugin.hpp luafar/makeflags.lua
	@echo generating $@
	@$(LUA) luafar/makeflags.lua $(COMINC)/plugin.hpp > $@

luafar/keysandcolors.c: luafar/makefarkeys.lua $(COMINC)/farcolor.hpp $(FARDIR)/uuids.far.dialogs.hpp
	@echo generating $@
	@$(LUA) luafar/makefarkeys.lua $(COMINC)/farcolor.hpp $(FARDIR)/uuids.far.dialogs.hpp $@

clean::
	@$(RM) $(DLLDIR)/lua*.* $(OBJS) $(DEPS)
