diff --git a/Makefile b/Makefile index 8eadf7a..e542a5f 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ CC ?= gcc PKG_CONFIG ?= pkg-config CFLAGS ?= -ansi -O0 -g3 -Wall -Wextra -Werror -Wconversion \ -Wstrict-prototypes -Wno-unused-parameter -pedantic -CFLAGS += -fPIC -DMPACK_DEBUG_REGISTRY_LEAK +CFLAGS += -fPIC -std=c99 -DMPACK_DEBUG_REGISTRY_LEAK ifeq ($(MPACK_LUA_VERSION_NOPATCH),5.3) # Lua 5.3 has integer type, which is not 64 bits for -ansi since c89 doesn't # have `long long` type. diff --git a/README.md b/README.md index 45339b7..53aabfe 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,15 @@ [![Travis Build Status](https://travis-ci.org/libmpack/libmpack-lua.svg?branch=master)](https://travis-ci.org/libmpack/libmpack-lua) +## Building + +```bash +LUA_TARGET=$(PLATFORM) make +``` + +Where `PLATFORM` is a supported Lua 5.1 platform: linux (default), freebsd, macosx, ... + +For the complete list of targets run: +```bash +make; cd .deps/5.1.5/src/lua && make +``` diff --git a/lmpack.c b/lmpack.c index 2fbd855..fa22989 100644 --- a/lmpack.c +++ b/lmpack.c @@ -16,7 +16,12 @@ */ #define LUA_LIB /* for snprintf */ +#ifdef __APPLE__ +// Apple uses C99 source, not XOPEN +#define _C99_SOURCE 1 +#else #define _XOPEN_SOURCE 500 +#endif #include #include #include