Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Commit e189bbc

Browse files
author
Federico Francescon
committed
Fixed lua-cjson to be working with our compile system
1 parent e8972ac commit e189bbc

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ notes
55
packages
66
tags
77
tests/utf8.dat
8+
cmp/*

Makefile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@
1111
## multi-threaded application. Requries _pthreads_.
1212

1313
##### Build defaults #####
14-
LUA_VERSION = 5.3
14+
LUA_VERSION = 5.4
1515
TARGET = cjson.so
1616
PREFIX = /usr/local
17-
#CFLAGS = -g -Wall -pedantic -fno-inline
18-
CFLAGS = -O3 -Wall -pedantic -DNDEBUG
1917
CJSON_CFLAGS = -fpic
2018
CJSON_LDFLAGS = -shared
19+
ifdef GWC_ARCH
20+
BD = cmp/$(GWC_ARCH)/
21+
LUA_INCLUDE_DIR ?= ../lua
22+
else
23+
BD = ./
24+
#CFLAGS = -g -Wall -pedantic -fno-inline
25+
CFLAGS = -O3 -Wall -pedantic -DNDEBUG
2126
LUA_INCLUDE_DIR = $(PREFIX)/include
2227
LUA_CMODULE_DIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
2328
LUA_MODULE_DIR = $(PREFIX)/share/lua/$(LUA_VERSION)
2429
LUA_BIN_DIR = $(PREFIX)/bin
30+
endif
2531

2632
##### Platform overrides #####
2733
##
@@ -82,12 +88,14 @@ ASCIIDOC = asciidoc
8288
BUILD_CFLAGS = -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS)
8389
OBJS = lua_cjson.o strbuf.o $(FPCONV_OBJS)
8490

91+
$(shell mkdir -p "$(BD)")
92+
8593
.PHONY: all clean install install-extra doc
8694

8795
.SUFFIXES: .html .adoc
8896

8997
.c.o:
90-
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $@ $<
98+
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $(BD)/$@ $<
9199

92100
.adoc.html:
93101
$(ASCIIDOC) -n -a toc $<
@@ -97,7 +105,8 @@ all: $(TARGET)
97105
doc: manual.html performance.html
98106

99107
$(TARGET): $(OBJS)
100-
$(CC) $(LDFLAGS) $(CJSON_LDFLAGS) -o $@ $(OBJS)
108+
mkdir -p $(BD)
109+
$(CC) $(LDFLAGS) $(CJSON_LDFLAGS) -o $(BD)/$@ $(addprefix $(BD)/, $(OBJS))
101110

102111
install: $(TARGET)
103112
mkdir -p $(DESTDIR)/$(LUA_CMODULE_DIR)
@@ -117,4 +126,4 @@ install-extra:
117126
cd tests; chmod $(DATAPERM) $(TEST_FILES); chmod $(EXECPERM) *.lua *.pl
118127

119128
clean:
120-
rm -f *.o $(TARGET)
129+
rm -f $(BD)/*.o $(BD)/$(TARGET)

lua_cjson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#endif
5252

5353
#ifndef CJSON_VERSION
54-
#define CJSON_VERSION "2.1devel"
54+
#define CJSON_VERSION "2.1.hig"
5555
#endif
5656

5757
#ifdef _MSC_VER

0 commit comments

Comments
 (0)