From 7122dcdc8143c76336074fec1de172d6c569f0c2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 22 Sep 2021 23:51:34 -0700 Subject: Added Lua bindings --- Lua/Makefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Lua/Makefile (limited to 'Lua/Makefile') diff --git a/Lua/Makefile b/Lua/Makefile new file mode 100644 index 0000000..4569ce6 --- /dev/null +++ b/Lua/Makefile @@ -0,0 +1,48 @@ +NAME=bp +CC=cc +PREFIX=/usr/local +LUA_DIR=/usr/local +LUA_INC= $(LUA_DIR)/include +LUA=lua +INCS=-I$(LUA_INC) +CFLAGS=-std=c99 -Werror -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -flto +CWARN=-Wall -Wextra + # -Wpedantic -Wsign-conversion -Wtype-limits -Wunused-result -Wnull-dereference \ + # -Waggregate-return -Walloc-zero -Walloca -Warith-conversion -Wcast-align -Wcast-align=strict \ + # -Wdangling-else -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches \ + # -Wduplicated-cond -Wexpansion-to-defined -Wfloat-conversion -Wfloat-equal -Wformat-nonliteral \ + # -Wformat-security -Wformat-signedness -Wframe-address -Winline -Winvalid-pch -Wjump-misses-init \ + # -Wlogical-op -Wlong-long -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn \ + # -Wnull-dereference -Woverlength-strings -Wpacked -Wpacked-not-aligned -Wpointer-arith \ + # -Wredundant-decls -Wshadow -Wshadow=compatible-local -Wshadow=global -Wshadow=local \ + # -Wsign-conversion -Wstack-protector -Wsuggest-attribute=const -Wswitch-default -Wswitch-enum \ + # -Wsync-nand -Wtrampolines -Wundef -Wunsuffixed-float-constants -Wunused -Wunused-but-set-variable \ + # -Wunused-const-variable -Wunused-local-typedefs -Wunused-macros -Wvariadic-macros -Wvector-operation-performance \ + # -Wvla -Wwrite-strings +OSFLAGS != case $$(uname -s) in *BSD|Darwin) echo '-D_BSD_SOURCE';; Linux) echo '-D_GNU_SOURCE';; *) echo '-D_DEFAULT_SOURCE';; esac +EXTRA= +G= +O=-O3 +ALL_FLAGS=$(CFLAGS) $(OSFLAGS) $(INCS) $(EXTRA) $(CWARN) $(G) $(O) + +ifeq ($(shell uname -s),Darwin) + MAKESO= $(CC) -bundle -undefined dynamic_lookup +else + MAKESO= $(CC) -shared +endif + +all: bp.so + +clean: + rm -f lbp.o bp.so + +lbp.o: lbp.c + $(CC) -c $(ALL_FLAGS) -o $@ $< + +bp.so: lbp.o ../print.o ../files.o ../pattern.o ../utils.o ../utf8.o ../match.o ../definitions.o + $(MAKESO) -o $@ $^ + +test: bp.so + $(LUA) test.lua + +.PHONY: all clean test -- cgit v1.2.3