blob: afb23c4558a768f1a9deec6fb09b48f034a9cd24 [file] [log] [blame]
Thiago Macieirad4c9ecb2015-09-26 00:21:06 -07001ALLTESTS = open_memstream funopen gc_sections \
2 system-cjson cjson
Thiago Macieira2a5fb792015-09-18 11:34:11 -07003MAKEFILE := $(lastword $(MAKEFILE_LIST))
4OUT :=
5
6PROGRAM-open_memstream = extern int open_memstream(); int main() { return open_memstream(); }
7PROGRAM-funopen = extern int funopen(); int main() { return funopen(); }
8PROGRAM-gc_sections = int main() {}
9CCFLAGS-gc_sections = -Wl,--gc-sections
10
Thiago Macieirad4c9ecb2015-09-26 00:21:06 -070011PROGRAM-cjson = \#include <stdlib.h>\n
12PROGRAM-cjson += \#include <cJSON.h>\n
13PROGRAM-cjson += int main() { return cJSON_False; }
14CCFLAGS-cjson = -I$(dir $(MAKEFILE))src/cjson
15PROGRAM-system-cjson = $(PROGRAM-cjson)
16CCLFAGS-system-cjson = -lcJSON
17
Thiago Macieira2a5fb792015-09-18 11:34:11 -070018sink:
19 @echo >&2 Please run from the top-level Makefile.
20
21configure: $(foreach it,$(ALLTESTS),check-$(it))
22
23check-%:
24 @echo $(subst check-,,$@)-tested := 1 $(OUT)
Thiago Macieirad4c9ecb2015-09-26 00:21:06 -070025 $(if $(V),,@)if echo -e "$($(subst check-,PROGRAM-,$@))" | \
Thiago Macieira2a5fb792015-09-18 11:34:11 -070026 $(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