-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (41 loc) · 1.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Makefile for Lua BitOp -- a bit operations library for Lua 5.1/5.2.
# To compile with MSVC please run: msvcbuild.bat
# To compile with MinGW please run: mingw32-make -f Makefile.mingw
# Include path where lua.h, luaconf.h and lauxlib.h reside:
LUAV ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)")
PREFIX ?=/usr/local
INCLUDES ?= -I$(PREFIX)/include/lua$(LUAV)
DEFINES=
# Use this for the old ARM ABI with swapped FPA doubles.
# Do NOT use this for modern ARM EABI with VFP or soft-float!
#DEFINES= -DSWAPPED_DOUBLE
# Lua executable name. Used to find the install path and for testing.
LUA= lua
CC= gcc
CCOPT= -O2 -fomit-frame-pointer
CCWARN= -Wall
SOCC= $(CC) -shared
SOCFLAGS= -fPIC $(CCOPT) $(CCWARN) $(DEFINES) $(INCLUDES) $(CFLAGS)
SOLDFLAGS= -fPIC $(LDFLAGS)
RM= rm -f
INSTALL= install -p
INSTALLPATH= $(LUA) installpath.lua
MODNAME= bit
MODSO= $(MODNAME).so
all: $(MODSO)
# Alternative target for compiling on Mac OS X:
macosx:
$(MAKE) all "SOCC=MACOSX_DEPLOYMENT_TARGET=10.4 $(CC) -dynamiclib -single_module -undefined dynamic_lookup"
$(MODNAME).o: $(MODNAME).c
$(CC) $(SOCFLAGS) -c -o $@ $<
$(MODSO): $(MODNAME).o
$(SOCC) $(SOLDFLAGS) -o $@ $<
install: $(MODSO)
$(INSTALL) $< `$(INSTALLPATH) $(MODNAME)`
test: $(MODSO)
@$(LUA) bittest.lua && echo "basic test OK"
@$(LUA) nsievebits.lua && echo "nsievebits test OK"
@$(LUA) md5test.lua && echo "MD5 test OK"
clean:
$(RM) *.o *.so *.obj *.lib *.exp *.dll *.manifest
.PHONY: all macosx install test clean