diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 58 |
1 files changed, 38 insertions, 20 deletions
@@ -4,31 +4,49 @@ LUA_VERSION = 5.1 | |||
4 | # See http://lua-users.org/wiki/BuildingModules for platform specific | 4 | # See http://lua-users.org/wiki/BuildingModules for platform specific |
5 | # details. | 5 | # details. |
6 | 6 | ||
7 | ## Linux/BSD | 7 | ## Available Lua CJSON specific workarounds |
8 | PREFIX ?= /usr/local | 8 | # |
9 | LDFLAGS += -shared | 9 | # To ensure JSON encoding/decoding works correctly for locales using |
10 | # comma decimal separators, Lua CJSON must be compiled with one of | ||
11 | # these options: | ||
12 | # USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended option. | ||
13 | # USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when | ||
14 | # thread-safety isn't required. | ||
15 | # | ||
16 | # USE_INTERNAL_ISINF: Handle Solaris platforms that are missing isinf(). | ||
17 | |||
18 | # Tweak one of these platform sections below to suit your situation. | ||
19 | |||
20 | ## Linux | ||
21 | PREFIX ?= /usr/local | ||
22 | CFLAGS_EXTRA ?= -DUSE_POSIX_USELOCALE | ||
23 | LDFLAGS_EXTRA ?= -shared | ||
24 | |||
25 | ## FreeBSD | ||
26 | #PREFIX ?= /usr/local | ||
27 | #CFLAGS_EXTRA ?= -DUSE_POSIX_SETLOCALE | ||
28 | #LUA_INCLUDE_DIR ?= $(PREFIX)/include/lua51 | ||
29 | #LDFLAGS_EXTRA ?= -shared | ||
10 | 30 | ||
11 | ## OSX (Macports) | 31 | ## OSX (Macports) |
12 | #PREFIX ?= /opt/local | 32 | #PREFIX ?= /opt/local |
13 | #LDFLAGS += -bundle -undefined dynamic_lookup | 33 | #CFLAGS_EXTRA ?= -DUSE_POSIX_USELOCALE |
34 | #LDFLAGS_EXTRA ?= -bundle -undefined dynamic_lookup | ||
14 | 35 | ||
15 | LUA_INCLUDE_DIR ?= $(PREFIX)/include | 36 | ## Solaris |
16 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) | 37 | #PREFIX ?= /usr/local |
38 | #CFLAGS_EXTRA ?= -DUSE_POSIX_SETLOCALE -DUSE_INTERNAL_ISINF | ||
39 | #LDFLAGS_EXTRA ?= -shared | ||
17 | 40 | ||
18 | #CFLAGS ?= -g -Wall -pedantic -fno-inline | 41 | ## End platform specific section |
19 | CFLAGS ?= -g -O3 -Wall -pedantic | ||
20 | override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" | ||
21 | 42 | ||
22 | ## Optional work arounds | 43 | LUA_INCLUDE_DIR ?= $(PREFIX)/include |
23 | # Handle Solaris platforms that are missing isinf(). | 44 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) |
24 | #override CFLAGS += -DUSE_INTERNAL_ISINF | 45 | |
25 | # Handle locales that use comma as a decimal separator on locale aware | 46 | #CFLAGS ?= -g -Wall -pedantic -fno-inline |
26 | # platforms (optional, but recommended). | 47 | CFLAGS ?= -O3 -Wall -pedantic |
27 | # USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended option. | 48 | override CFLAGS += $(CFLAGS_EXTRA) -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" |
28 | # USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when | 49 | override LDFLAGS += $(LDFLAGS_EXTRA) |
29 | # thread-safety isn't required. | ||
30 | override CFLAGS += -DUSE_POSIX_USELOCALE | ||
31 | #override CFLAGS += -DUSE_POSIX_SETLOCALE | ||
32 | 50 | ||
33 | INSTALL ?= install | 51 | INSTALL ?= install |
34 | 52 | ||