1 # Makefile for the UCW JSON library
2 # (c) 2015 Martin Mares <mj@ucw.cz>
5 PROGS+=$(o)/ucw-json/json-test
7 LIBJSON_MODS=json parse format
8 LIBJSON_MOD_PATHS=$(addprefix $(o)/ucw-json/,$(LIBJSON_MODS))
9 LIBJSON_INCLUDES=json.h
10 LIBJSON_DEPS=$(LIBUCW)
11 export LIBJSON_LIBS=-lm
13 $(o)/ucw-json/libucw-json$(LV).a: $(addsuffix .o,$(LIBJSON_MOD_PATHS))
14 $(o)/ucw-json/libucw-json$(LV).so: $(addsuffix .oo,$(LIBJSON_MOD_PATHS)) $(LIBJSON_DEPS)
15 $(o)/ucw-json/libucw-json$(LV).so: SONAME_SUFFIX=.0
16 $(o)/ucw-json/libucw-json$(LV).so: LIBS+=$(LIBJSON_LIBS)
17 $(o)/ucw-json/libucw-json.pc: $(LIBJSON_DEPS)
19 ifdef CONFIG_INSTALL_API
20 $(o)/ucw-json/libucw-json.pc: $(addprefix $(o)/ucw-json/libucw-json$(LV),.a .so)
23 TESTS+=$(o)/ucw-json/json-test.test
24 $(o)/ucw-json/json-test: $(o)/ucw-json/json-test.o $(LIBJSON) $(LIBUCW)
25 $(o)/ucw-json/json-test.test: $(o)/ucw-json/json-test
28 API_INCLUDES+=$(o)/ucw-json/.include-stamp
29 $(o)/ucw-json/.include-stamp: $(addprefix $(s)/ucw-json/,$(LIBJSON_INCLUDES))
30 $(o)/ucw-json/.include-stamp: IDST=ucw-json
31 run/lib/pkgconfig/libucw-json.pc: $(o)/ucw-json/libucw-json.pc
33 INSTALL_TARGETS+=install-libucw-json-lib
34 install-libucw-json-lib:
35 install -d -m 755 $(DESTDIR)$(INSTALL_LIB_DIR)
36 install -m 644 run/lib/libucw-json$(LV).so.0 $(DESTDIR)$(INSTALL_LIB_DIR)/libucw-json$(LV).so.0.0
37 ln -sf libucw-json$(LV).so.0.0 $(DESTDIR)$(INSTALL_LIB_DIR)/libucw-json$(LV).so.0
38 .PHONY: install-libucw-json-lib
40 INSTALL_TARGETS+=install-libucw-json-api
41 install-libucw-json-api:
42 install -d -m 755 $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw-json $(DESTDIR)$(INSTALL_LIB_DIR) $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
43 install -m 644 run/lib/pkgconfig/libucw-json.pc $(DESTDIR)$(INSTALL_PKGCONFIG_DIR)
44 install -m 644 $(addprefix run/include/ucw-json/,$(LIBJSON_INCLUDES)) $(DESTDIR)$(INSTALL_INCLUDE_DIR)/ucw-json
45 ln -sf libucw-json$(LV).so.0.0 $(DESTDIR)$(INSTALL_LIB_DIR)/libucw-json$(LV).so
46 install -m 644 run/lib/libucw-json$(LV).a $(DESTDIR)$(INSTALL_LIB_DIR)
47 .PHONY: install-libucw-json-api
49 include $(s)/ucw-json/doc/Makefile