<commit_before>
# either works

#LUA_INC_DIR=/opt/local/include/luajit-2.0
#LUA_LIB_DIR=/opt/local/lib
#LUA_LIB=luajit-5.1.2
#LUA=luajit

LUA_INC_DIR=/opt/local/include
LUA_LIB_DIR=/opt/local/lib
LUA_LIB=lua
LUA=lua

# need to hack a linux version here
#
# MAC OS X: note using ".so" suffix NOT ".dylib"
libinjection.so: libinjection_wrap.c
	gcc -g -O0 -I. -I${LUA_INC_DIR} -L${LUA_LIB_DIR} -l${LUA_LIB} \
	-dynamiclib libinjection_wrap.c libinjection_sqli.c -o libinjection.so

# build and run unit tests
# Uses a python helper to read the test files to generate
# a TAP test plan.  Easier that writing lots of LUA glue code
# and super-fast!
#
test-unit: libinjection.so
	./make_test.py > unit-test.t
	LUA_PATH='?.lua;lua-TestMore/src/?.lua' ${LUA} unit-test.t

libinjection_wrap.c: copy libinjection.i
	swig -lua libinjection.i

fingerprints.lua: generate_lua_fingerprints.py ../c/sqlparse_data.json
	./generate_lua_fingerprints.py < ../c/sqlparse_data.json > sqlifingerprints.lua

libinjection.h: ../c/libinjection.h
	cp ../c/libinjection.h libinjection.h

libinjection_sqli.c: ../c/libinjection_sqli.c
	cp ../c/libinjection_sqli.c libinjection_sqli.c

libinjection_sqli_data.h: ../c/libinjection_sqli_data.h
	cp ../c/libinjection_sqli_data.h libinjection_sqli_data.h

copy: libinjection.h libinjection_sqli.c libinjection_sqli_data.h

clean:<commit_msg>attempt at linux shared libraries, take 1<commit_after>
# either works

#LUA_INC_DIR=/opt/local/include/luajit-2.0
#LUA_LIB_DIR=/opt/local/lib
#LUA_LIB=luajit-5.1.2
#LUA=luajit

LUA_INC_DIR=/opt/local/include
LUA_LIB_DIR=/opt/local/lib
LUA_LIB=lua
LUA=lua

SHARED=-shared -Wl,-soname,libinjection.so
CFLAGS= -O0 -g -Wall -Werror
APPLE=$(shell uname -a | grep -c Darwin)
ifeq ($(APPLE),1)
	SHARED=-dynamiclib
endif

# need to hack a linux version here
#
# MAC OS X: note using ".so" suffix NOT ".dylib"
libinjection.so: libinjection_wrap.c
	${CC} ${CFLAGS} -I. -I${LUA_INC_DIR} -L${LUA_LIB_DIR} -l${LUA_LIB} \
	${SHARED} libinjection_wrap.c libinjection_sqli.c -o libinjection.so

# build and run unit tests
# Uses a python helper to read the test files to generate
# a TAP test plan.  Easier that writing lots of LUA glue code
# and super-fast!
#
test-unit: libinjection.so
	./make_test.py > unit-test.t
	LUA_PATH='?.lua;lua-TestMore/src/?.lua' ${LUA} unit-test.t

libinjection_wrap.c: copy libinjection.i
	swig -lua libinjection.i

fingerprints.lua: generate_lua_fingerprints.py ../c/sqlparse_data.json
	./generate_lua_fingerprints.py < ../c/sqlparse_data.json > sqlifingerprints.lua

libinjection.h: ../c/libinjection.h
	cp ../c/libinjection.h libinjection.h

libinjection_sqli.c: ../c/libinjection_sqli.c
	cp ../c/libinjection_sqli.c libinjection_sqli.c

libinjection_sqli_data.h: ../c/libinjection_sqli_data.h
	cp ../c/libinjection_sqli_data.h libinjection_sqli_data.h

copy: libinjection.h libinjection_sqli.c libinjection_sqli_data.h

clean:
{'fraction_non_alphanumeric': 0.1287435456110155, 'fraction_numerical': 0.004819277108433735, 'mean_word_length': 4.381481481481481, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6132117', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1158, 'n_words': 241}