-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
58 lines (47 loc) · 1.16 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
57
58
# 2009-03-16 by gf
# generic compiler and linker settings:
INCDIR ?= -I../lua/src
LIBDIR ?= -L. -L../lua/src
LIB =
CFLAGS = -Os -Wall -c #-g
# generic platform specific rules:
ARCH = $(shell uname -s)
ifeq ($(ARCH),Linux)
CFLAGS += -fPIC
LFLAGS = -fPIC -shared
LIBS = $(LIBDIR) $(LIB) -llua -ldl
EXESUFFIX =
SHLIBSUFFIX = .so
else
ifeq ($(ARCH),Darwin) # MacOSX
LFLAGS = -bundle
LIBS = $(LIBDIR) -L/usr/local/lib $(LIB) -llua
EXESUFFIX = .app
SHLIBSUFFIX = .so
else # windows, MinGW
LFLAGS = -shared
LIBS = $(LIBDIR) $(LIB) -llua51 -mconsole -s
EXESUFFIX = .exe
SHLIBSUFFIX = .dll
endif
endif
# project specific targets:
all: LuaXML_lib$(SHLIBSUFFIX)
# project specific link rules:
LuaXML_lib$(SHLIBSUFFIX): LuaXML_lib.o
$(CC) -o $@ $(LFLAGS) $^ $(LIBS)
# project specific dependencies:
LuaXML_lib.o: LuaXML_lib.c
# generic rules and targets:
.c.o:
$(CC) $(CFLAGS) $(INCDIR) -c $<
clean:
rm -f *.o *~ LuaXML_lib.so LuaXML_lib.dll
# run tests
LUA ?= lua
test:
$(LUA) -v unittest.lua
$(LUA) test.lua
# generate documentation (requires LDoc)
doc:
ldoc -c .ldoc/config.ld .