Merge branch 'upstream' into tizen
[platform/upstream/iotivity.git] / extlibs / tinycbor / tinycbor / Makefile.configure
1 ALLTESTS = open_memstream funopen gc_sections \
2            system-cjson cjson
3 MAKEFILE := $(lastword $(MAKEFILE_LIST))
4 OUT :=
5
6 PROGRAM-open_memstream = extern int open_memstream(); int main() { return open_memstream(); }
7 PROGRAM-funopen = extern int funopen(); int main() { return funopen(); }
8 PROGRAM-gc_sections = int main() {}
9 CCFLAGS-gc_sections = -Wl,--gc-sections
10
11 PROGRAM-cjson  = \#include <stdlib.h>\n
12 PROGRAM-cjson += \#include <cJSON.h>\n
13 PROGRAM-cjson += int main() { return cJSON_False; }
14 CCFLAGS-cjson = -I$(dir $(MAKEFILE))src/cjson
15 PROGRAM-system-cjson = $(PROGRAM-cjson)
16 CCLFAGS-system-cjson = -lcJSON
17
18 sink:
19         @echo >&2 Please run from the top-level Makefile.
20
21 configure: $(foreach it,$(ALLTESTS),check-$(it))
22
23 check-%:
24         @echo $(subst check-,,$@)-tested := 1 $(OUT)
25         $(if $(V),,@)if echo -e "$($(subst check-,PROGRAM-,$@))" | \
26             $(CC) -xc $($(subst check-,CCFLAGS-,$@)) -o /dev/null - $(if $(V),,>/dev/null 2>&1); \
27         then \
28             echo $(subst check-,,$@)-pass := 1 $(OUT); \
29         fi