From 10abc615fae65f23ec0dbe03591e32b06fa8ff5e Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Tue, 6 Jun 2017 21:33:25 +0100 Subject: Replace find lua rules with luxio cargo Take the findlua.mk file from luxio and use it for this project. --- Makefile | 99 ++-------------------------------------------------------------- 1 file changed, 2 insertions(+), 97 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e32ab37..401808a 100644 --- a/Makefile +++ b/Makefile @@ -1,100 +1,3 @@ -ifeq ($(strip $(shell which pkg-config > /dev/null || echo NONE)),NONE) - $(error This makefile requires pkg-config) -endif - -ifeq ($(strip $(shell which $(CC) > /dev/null || echo NONE)),NONE) - $(info lua-scrypt: Hmm, CC make variable contains nonsense. Overriding to gcc.) - CC := gcc -endif - -NAKED_LUA_VER := $(shell (pkg-config --exists lua && \ - pkg-config --modversion lua || \ - pkg-config --variable V lua) | cut -d. -f1-2) - -# fine appropriate Lua interpreter -LUA_REPL := $(shell (which lua5.1 > /dev/null 2>&1 && echo lua5.1) || \ - (which lua-5.1 > /dev/null 2>&1 && echo lua-5.1) || \ - (which lua51 > /dev/null 2>&1 && echo lua51) || \ - (lua -e"print(_VERSION)" | grep -q 5.1 && echo lua) || \ - (which lua-5.2 > /dev/null 2>&1 && echo lua-5.2) || \ - (which lua52 > /dev/null 2>&1 && echo lua52)) - -# find appropriate Lua libraries -LUA51_PKG := $(shell (pkg-config --exists lua5.1 && echo lua5.1) || \ - (pkg-config --exists lua-5.1 && echo lua-5.1) || \ - (pkg-config --exists lua51 && echo lua51) || \ - (echo "NONE")) - - -LUA51_PKG := $(strip $(LUA51_PKG)) - -ifeq ($(LUA51_PKG),NONE) - ifeq ($(NAKED_LUA_VER),5.1) - LUA51_PKG := lua - endif -endif - -ifneq ($(LUA51_PKG),NONE) - $(info lua-scrypt: Lua 5.1 package name on this system is $(LUA51_PKG)) - LUA51_HAS_MODINST := $(shell test x`pkg-config --variable INSTALL_LMOD $(LUA51_PKG)` != x && echo YES) - LUA51_INC := $(shell pkg-config --cflags $(LUA51_PKG)) - LUA51_LIB := $(shell pkg-config --libs $(LUA51_PKG)) - ifeq ($(LUA51_HAS_MODINST),) - LOCAL := YES - endif - ifeq ($(LOCAL),) - LUA51_LMOD_INST := $(shell pkg-config --variable=INSTALL_LMOD $(LUA51_PKG)) - LUA51_CMOD_INST := $(shell pkg-config --variable=INSTALL_CMOD $(LUA51_PKG)) - else - LUA51_LMOD_INST := /usr/local/share/lua/5.1 - LUA51_CMOD_INST := /usr/local/lib/lua/5.1 - endif - lua-5.1-try: lua-5.1 - lua-5.1-try-install: lua-5.1-install -else -lua-5.1-try: - @echo lua-scrypt: Lua 5.1 could not be found, so lua-scrypt was not built for it. -lua-5.1-try-install: - @echo lua-scrypt: Lua 5.1 could not be found, so lua-scrypt was not installed for it. -endif - -LUA52_PKG := $(shell (pkg-config --exists lua5.2 && echo lua5.2) || \ - (pkg-config --exists lua-5.2 && echo lua-5.2) || \ - (pkg-config --exists lua52 && echo lua52) || \ - (echo "NONE")) - -LUA52_PKG := $(strip $(LUA52_PKG)) - -ifeq ($(LUA52_PKG),NONE) - ifeq ($(NAKED_LUA_VER),5.2) - LUA52_PKG := lua - endif -endif - -ifneq ($(LUA52_PKG),NONE) - $(info lua-scrypt: Lua 5.2 package name on this system is $(LUA52_PKG)) - LUA52_HAS_MODINST := $(shell test x`pkg-config --variable INSTALL_LMOD $(LUA52_PKG)` != x && echo YES) - LUA52_INC := $(shell pkg-config --cflags $(LUA52_PKG)) - LUA52_LIB := $(shell pkg-config --libs $(LUA52_PKG)) - ifeq ($(LUA52_HAS_MODINST),) - LOCAL := YES - endif - ifeq ($(LOCAL),) - LUA52_LMOD_INST := $(shell pkg-config --variable=INSTALL_LMOD $(LUA52_PKG)) - LUA52_CMOD_INST := $(shell pkg-config --variable=INSTALL_CMOD $(LUA52_PKG)) - else - LUA52_LMOD_INST := /usr/local/share/lua/5.2 - LUA52_CMOD_INST := /usr/local/lib/lua/5.2 - endif - lua-5.2-try: lua-5.2 - lua-5.2-try-install: lua-5.2-install -else -lua-5.2-try: - @echo lua-scrypt: Lua 5.2 could not be found, so lua-scrypt was not built for it. -lua-5.2-try-install: - @echo lua-scrypt: Lua 5.2 could not be found, so lua-scrypt was not installed for it. -endif - LIBCRYPT_C := lib/crypto/crypto_aesctr.c \ lib/crypto/crypto_scrypt-nosse.c \ lib/crypto/crypto_scrypt-ref.c \ @@ -107,6 +10,8 @@ override CFLAGS := $(CFLAGS) -O2 -Wall -fPIC all: lua-5.1-try lua-5.2-try +include findlua.mk + clean: $(RM) scrypt-5.1.so scrypt-5.2.so scrypt.so $(RM) luascrypt.o -- cgit v1.2.1