aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 23 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index f32e4b1..1eb1090 100644
--- a/Makefile
+++ b/Makefile
@@ -12,54 +12,55 @@ LUA_VERSION = 5.1
12# 12#
13# USE_INTERNAL_ISINF: Workaround for Solaris platforms missing isinf(). 13# USE_INTERNAL_ISINF: Workaround for Solaris platforms missing isinf().
14 14
15## Common build defaults 15## Build defaults
16PREFIX = /usr/local 16PREFIX = /usr/local
17CFLAGS_EXTRA = -DUSE_POSIX_SETLOCALE 17#CFLAGS = -g -Wall -pedantic -fno-inline
18LDFLAGS_EXTRA = -shared 18CFLAGS = -O3 -Wall -pedantic
19CJSON_CFLAGS = -DUSE_POSIX_SETLOCALE
20CJSON_LDFLAGS = -shared
21LUA_INCLUDE_DIR = $(PREFIX)/include
22LUA_MODULE_DIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
23INSTALL_CMD = install
19 24
20## Platform overrides 25## Platform overrides
21# 26#
22# Tweaking one of the platform sections below to suit your situation. 27# Tweak one of the platform sections below to suit your situation.
23# 28#
24# See http://lua-users.org/wiki/BuildingModules for further platform 29# See http://lua-users.org/wiki/BuildingModules for further platform
25# specific details. 30# specific details.
26 31
27## Linux 32## Linux
28CFLAGS_EXTRA = -DUSE_POSIX_USELOCALE 33#CJSON_CFLAGS = -DUSE_POSIX_USELOCALE
29 34
30## FreeBSD 35## FreeBSD
31#LUA_INCLUDE_DIR = $(PREFIX)/include/lua51 36#LUA_INCLUDE_DIR = $(PREFIX)/include/lua51
32 37
33## MacOSX (Macports) 38## MacOSX (Macports)
34#PREFIX = /opt/local 39#PREFIX = /opt/local
35#CFLAGS_EXTRA = -DUSE_POSIX_USELOCALE 40#CJSON_CFLAGS = -DUSE_POSIX_USELOCALE
36#LDFLAGS_EXTRA = -bundle -undefined dynamic_lookup 41#CJSON_LDFLAGS = -bundle -undefined dynamic_lookup
37 42
38## Solaris 43## Solaris
39#CFLAGS_EXTRA = -DUSE_POSIX_SETLOCALE -DUSE_INTERNAL_ISINF 44#CJSON_CFLAGS = -DUSE_POSIX_SETLOCALE -DUSE_INTERNAL_ISINF
40 45
41## End platform specific section 46## End platform specific section
42 47
43LUA_INCLUDE_DIR ?= $(PREFIX)/include 48CJSON_CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\"
44LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) 49OBJS := lua_cjson.o strbuf.o
45
46#CFLAGS ?= -g -Wall -pedantic -fno-inline
47CFLAGS ?= -O3 -Wall -pedantic
48override CFLAGS += $(CFLAGS_EXTRA) -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\"
49override LDFLAGS += $(LDFLAGS_EXTRA)
50
51INSTALL ?= install
52 50
53.PHONY: all clean install package 51.PHONY: all clean install package
54 52
55all: cjson.so 53all: cjson.so
56 54
57cjson.so: lua_cjson.o strbuf.o 55.c.o:
58 $(CC) $(LDFLAGS) -o $@ $^ 56 $(CC) -c $(CFLAGS) $(CPPFLAGS) $(CJSON_CFLAGS) -o $@ $<
57
58cjson.so: $(OBJS)
59 $(CC) $(LDFLAGS) $(CJSON_LDFLAGS) -o $@ $(OBJS)
59 60
60install: 61install: cjson.so
61 $(INSTALL) -d $(DESTDIR)/$(LUA_LIB_DIR) 62 mkdir -p $(DESTDIR)/$(LUA_MODULE_DIR)
62 $(INSTALL) cjson.so $(DESTDIR)/$(LUA_LIB_DIR) 63 $(INSTALL_CMD) cjson.so $(DESTDIR)/$(LUA_MODULE_DIR)
63 64
64clean: 65clean:
65 rm -f *.o *.so 66 rm -f *.o *.so