forked from intel/tinycbor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.configure
35 lines (30 loc) · 1.32 KB
/
Makefile.configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
ALLTESTS = open_memstream funopen fopencookie gc_sections \
system-cjson cjson freestanding
MAKEFILE := $(lastword $(MAKEFILE_LIST))
OUT :=
PROGRAM-open_memstream = extern int open_memstream(); int main() { return open_memstream(); }
PROGRAM-funopen = extern int funopen(); int main() { return funopen(); }
PROGRAM-fopencookie = extern int fopencookie(); int main() { return fopencookie(); }
PROGRAM-gc_sections = int main() {}
CCFLAGS-gc_sections = -Wl,--gc-sections
PROGRAM-freestanding = \#if !defined(__STDC_HOSTED__) || __STDC_HOSTED__-0 == 1\n
PROGRAM-freestanding += \#error Hosted implementation\n
PROGRAM-freestanding += \#endif\n
PROGRAM-freestanding += int main() {}
CCFLAGS-freestanding = $(CFLAGS)
PROGRAM-cjson = \#include <stdlib.h>\n
PROGRAM-cjson += \#include <cjson/cJSON.h>\n
PROGRAM-cjson += int main() { return cJSON_False; }
CCFLAGS-cjson = -I$(dir $(MAKEFILE))src
PROGRAM-system-cjson = $(PROGRAM-cjson)
CCFLAGS-system-cjson = -lcjson
sink:
@echo >&2 Please run from the top-level Makefile.
configure: $(foreach it,$(ALLTESTS),check-$(it))
check-%:
@echo $(subst check-,,$@)-tested := 1 >>$(OUT)
$(if $(V),,@)if printf "$($(subst check-,PROGRAM-,$@))" | \
$(CC) -xc $($(subst check-,CCFLAGS-,$@)) -o /dev/null - $(if $(V),,>/dev/null 2>&1); \
then \
echo $(subst check-,,$@)-pass := 1 >>$(OUT); \
fi