Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party CJSON
提交
778bcd1a
T
Third Party CJSON
项目概览
OpenHarmony
/
Third Party CJSON
大约 1 年 前同步成功
通知
6
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party CJSON
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
778bcd1a
编写于
11月 14, 2016
作者:
M
Max Bruckner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Makefile: Redo with library versioning
And remove special handling of SunOs
上级
46ff20c8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
120 addition
and
39 deletion
+120
-39
Makefile
Makefile
+120
-39
未找到文件。
Makefile
浏览文件 @
778bcd1a
OBJ
=
cJSON.o
LIBNAME
=
libcjson
TESTS
=
test
CJSON_OBJ
=
cJSON.o
UTILS_OBJ
=
cJSON_Utils.o
CJSON_LIBNAME
=
libcjson
UTILS_LIBNAME
=
libcjson_utils
CJSON_TEST
=
cJSON_test
UTILS_TEST
=
cJSON_test_utils
LDLIBS
=
-lm
LIBVERSION
=
1.0.0
CJSON_SOVERSION
=
1
UTILS_SOVERSION
=
1
PREFIX
?=
/usr/local
INCLUDE_PATH
?=
include/cjson
...
...
@@ -11,54 +20,126 @@ INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
INSTALL
?=
cp
-a
R_CFLAGS
=
-f
pic
$(CFLAGS)
-Wall
-Werror
-Wstrict-prototypes
-Wwrite-strings
-D_POSIX_C_SOURCE
=
200112L
R_CFLAGS
=
-f
PIC
-ansi
-pedantic
-Wall
-Werror
-Wstrict-prototypes
-Wwrite-strings
$(CFLAGS)
uname
_S
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo false'
)
uname
:=
$(
shell
sh
-c
'uname -s 2>/dev/null || echo false'
)
#
# shared lib
DYLIBNAME
=
$(LIBNAME)
.so
DYLIBCMD
=
$(CC)
-shared
-o
$(DYLIBNAME)
#
library file extensions
SHARED
=
so
STATIC
=
a
## create dynamic (shared) library on Darwin (base OS for MacOSX and IOS)
ifeq
(Darwin, $(uname_S))
DYLIBNAME
=
$(LIBNAME)
.dylib
## create dyanmic (shared) library on SunOS
else
ifeq
(SunOS, $(uname_S))
DYLIBCMD
=
$(CC)
-G
-o
$(DYLIBNAME)
INSTALL
=
cp
-r
ifeq
(Darwin, $(uname))
SHARED
=
dylib
endif
## static lib
STLIBNAME
=
$(LIBNAME)
.a
#cJSON library names
CJSON_SHARED
=
$(CJSON_LIBNAME)
.
$(SHARED)
CJSON_SHARED_VERSION
=
$(CJSON_LIBNAME)
.
$(SHARED)
.
$(LIBVERSION)
CJSON_SHARED_SO
=
$(CJSON_LIBNAME)
.
$(SHARED)
.
$(CJSON_SOVERSION)
CJSON_STATIC
=
$(CJSON_LIBNAME)
.
$(STATIC)
.PHONY
:
all clean install
#cJSON_Utils library names
UTILS_SHARED
=
$(UTILS_LIBNAME)
.
$(SHARED)
UTILS_SHARED_VERSION
=
$(UTILS_LIBNAME)
.
$(SHARED)
.
$(LIBVERSION)
UTILS_SHARED_SO
=
$(UTILS_LIBNAME)
.
$(SHARED)
.
$(UTILS_SOVERSION)
UTILS_STATIC
=
$(UTILS_LIBNAME)
.
$(STATIC)
all
:
$(DYLIBNAME) $(STLIBNAME) $(TESTS)
SHARED_CMD
=
$(CC)
-shared
-o
$(DYLIBNAME)
:
$(OBJ)
$(DYLIBCMD)
$<
$(LDFLAGS)
$(STLIBNAME)
:
$(OBJ)
$(AR)
rcs
$@
$<
.PHONY
:
all shared static tests clean install
$(OBJ)
:
cJSON.c cJSON.h
all
:
shared static tests
.c.o
:
$(CC)
-ansi
-pedantic
-c
$(R_CFLAGS)
$<
shared
:
$(CJSON_SHARED) $(UTILS_SHARED)
$(TESTS)
:
cJSON.c cJSON.h test.c
$(CC)
cJSON.c test.c
-o
test
-lm
-I
.
static
:
$(CJSON_STATIC) $(UTILS_STATIC)
install
:
$(DYLIBNAME) $(STLIBNAME)
mkdir
-p
$(INSTALL_LIBRARY_PATH)
$(INSTALL_INCLUDE_PATH)
$(INSTALL)
cJSON.h
$(INSTALL_INCLUDE_PATH)
$(INSTALL)
$(DYLIBNAME)
$(INSTALL_LIBRARY_PATH)
$(INSTALL)
$(STLIBNAME)
$(INSTALL_LIBRARY_PATH)
tests
:
$(CJSON_TEST) $(UTILS_TEST)
uninstall
:
rm
-rf
$(INSTALL_LIBRARY_PATH)
/
$(DYLIBNAME)
rm
-rf
$(INSTALL_LIBRARY_PATH)
/
$(STLIBNAME)
rm
-rf
$(INSTALL_INCLUDE_PATH)
/cJSON.h
test
:
tests
./
$(CJSON_TEST)
./
$(UTILS_TEST)
clean
:
rm
-rf
$(DYLIBNAME)
$(STLIBNAME)
$(TESTS)
*
.o
.c.o
:
$(CC)
-ansi
-pedantic
-c
$(R_CFLAGS)
$<
#tests
#cJSON
$(CJSON_TEST)
:
cJSON.c cJSON.h test.c
$(CC)
$^
-o
$@
$(LDLIBS)
-I
.
#cJSON_Utils
$(UTILS_TEST)
:
cJSON.c cJSON.h test.c
$(CC)
$^
-o
$@
$(LDLIBS)
-I
.
#static libraries
#cJSON
$(CJSON_STATIC)
:
$(CJSON_OBJ)
$(AR)
rcs
$@
$<
#cJSON_Utils
$(UTILS_STATIC)
:
$(UTILS_OBJ)
$(AR)
rcs
$@
$<
#shared libraries .so.1.0.0
#cJSON
$(CJSON_SHARED_VERSION)
:
$(CJSON_OBJ)
$(CC)
-shared
-o
$@
$<
$(LDFLAGS)
#cJSON_Utils
$(UTILS_SHARED_VERSION)
:
$(UTILS_OBJ)
$(CC)
-shared
-o
$@
$<
$(LDFLAGS)
#objects
#cJSON
$(CJSON_OBJ)
:
cJSON.c cJSON.h
#cJSON_Utils
$(UTILS_OBJ)
:
cJSON_Utils.c cJSON_Utils.h
#links .so -> .so.1 -> .so.1.0.0
#cJSON
$(CJSON_SHARED_SO)
:
$(CJSON_SHARED_VERSION)
ln
-s
$(CJSON_SHARED_VERSION)
$(CJSON_SHARED_SO)
$(CJSON_SHARED)
:
$(CJSON_SHARED_SO)
ln
-s
$(CJSON_SHARED_SO)
$(CJSON_SHARED)
#cJSON_Utils
$(UTILS_SHARED_SO)
:
$(UTILS_SHARED_VERSION)
ln
-s
$(UTILS_SHARED_VERSION)
$(UTILS_SHARED_SO)
$(UTILS_SHARED)
:
$(UTILS_SHARED_SO)
ln
-s
$(UTILS_SHARED_SO)
$(UTILS_SHARED)
#install
#cJSON
install-cjson
:
mkdir
-p
$(INSTALL_LIBRARY_PATH)
$(INSTALL_INCLUDE_PATH)
$(INSTALL)
cJSON.h
$(INSTALL_INCLUDE_PATH)
$(INSTALL)
$(CJSON_SHARED)
$(CJSON_SHARED_SO)
$(CJSON_SHARED_VERSION)
$(INSTALL_LIBRARY_PATH)
#cJSON_Utils
install-utils
:
install-cjson
$(INSTALL)
cJSON_Utils.h
$(INSTALL_INCLUDE_PATH)
$(INSTALL)
$(UTILS_SHARED)
$(UTILS_SHARED_SO)
$(UTILS_SHARED_VERSION)
$(INSTALL_LIBRARY_PATH)
install
:
install-cjson install-utils
#uninstall
#cJSON
uninstall-cjson
:
uninstall-utils
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(CJSON_SHARED)
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(CJSON_SHARED_VERSION)
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(CJSON_SHARED_SO)
rmdir
$(INSTALL_LIBRARY_PATH)
$(RM)
$(INSTALL_INCLUDE_PATH)
/cJSON.h
rmdir
$(INSTALL_INCLUDE_PATH)
#cJSON_Utils
uninstall-utils
:
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(UTILS_SHARED)
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(UTILS_SHARED_VERSION)
$(RM)
$(INSTALL_LIBRARY_PATH)
/
$(UTILS_SHARED_SO)
$(RM)
$(INSTALL_INCLUDE_PATH)
/cJSON_Utils.h
uninstall
:
uninstall-utils uninstall-cjson
clean
:
$(RM)
$(CJSON_OBJ)
$(UTILS_OBJ)
#delete object files
$(RM)
$(CJSON_SHARED)
$(CJSON_SHARED_VERSION)
$(CJSON_SHARED_SO)
$(CJSON_STATIC)
#delete cJSON
$(RM)
$(UTILS_SHARED)
$(UTILS_SHARED_VERSION)
$(UTILS_SHARED_SO)
$(UTILS_STATIC)
#delete cJSON_Utils
$(RM)
$(CJSON_TEST)
$(UTILS_TEST)
#delete tests
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录