|
51 | 51 | OUTPUT_BINARY := $(BINDIR)/host_tests
|
52 | 52 | LCOV_DIRECTORY := $(BINDIR)/../lcov
|
53 | 53 |
|
54 |
| -# Core files sometimes override libc functions, check when necessary to hide them |
55 |
| -# TODO proper configure script / other build system? |
56 |
| -ifeq (,$(wildcard ./.have_strlcpy)) |
57 |
| -$(shell echo -e '#include <cstring>\nint main(){char a[4]; char b[4]; strlcpy(&a[0], &b[0], sizeof(a)); return 0;}' | \ |
58 |
| - $(CXX) -x c++ - -o .have_strlcpy 2>/dev/null || { echo -e '#!/bin/sh\nexit 1' > .have_strlcpy ; chmod +x .have_strlcpy; }) |
59 |
| -endif |
60 |
| - |
61 |
| -$(shell ./.have_strlcpy) |
62 |
| -ifeq ($(.SHELLSTATUS), 0) |
63 |
| -FLAGS += -DHAVE_STRLCPY |
64 |
| -endif |
65 |
| - |
66 |
| -ifeq (,$(wildcard ./.have_strlcat)) |
67 |
| -$(shell echo -e '#include <cstring>\nint main(){char a[4]; strlcat(&a[0], "test", sizeof(a)); return 0;}' | \ |
68 |
| - $(CXX) -x c++ - -o .have_strlcat 2>/dev/null || { echo -e '#!/bin/sh\nexit 1' > .have_strlcat ; chmod +x .have_strlcat; }) |
69 |
| -endif |
70 |
| - |
71 |
| -$(shell ./.have_strlcat) |
72 |
| -ifeq ($(.SHELLSTATUS), 0) |
73 |
| -FLAGS += -DHAVE_STRLCAT |
74 |
| -endif |
75 |
| - |
76 | 54 | # Hide full build commands by default
|
77 | 55 | ifeq ($(V), 0)
|
78 | 56 | VERBC = @echo "C $@";
|
|
90 | 68 |
|
91 | 69 | $(shell mkdir -p $(BINDIR))
|
92 | 70 |
|
| 71 | +# Core files sometimes override libc functions, check when necessary to hide them |
| 72 | +# TODO proper configure script / other build system? |
| 73 | +ifeq (,$(wildcard $(BINDIR)/.have_strlcpy)) |
| 74 | +$(shell echo -e '#include <cstring>\nint main(){char a[4]; char b[4]; strlcpy(&a[0], &b[0], sizeof(a)); return 0;}' | \ |
| 75 | + $(CXX) -x c++ - -o $(BINDIR)/.have_strlcpy 2>/dev/null || { echo -e '#!/bin/sh\nexit 1' > $(BINDIR)/.have_strlcpy ; chmod +x $(BINDIR)/.have_strlcpy; }) |
| 76 | +endif |
| 77 | + |
| 78 | +$(shell $(BINDIR)/.have_strlcpy) |
| 79 | +ifeq ($(.SHELLSTATUS), 0) |
| 80 | +FLAGS += -DHAVE_STRLCPY |
| 81 | +endif |
| 82 | + |
| 83 | +ifeq (,$(wildcard $(BINDIR)/.have_strlcat)) |
| 84 | +$(shell echo -e '#include <cstring>\nint main(){char a[4]; strlcat(&a[0], "test", sizeof(a)); return 0;}' | \ |
| 85 | + $(CXX) -x c++ - -o $(BINDIR)/.have_strlcat 2>/dev/null || { echo -e '#!/bin/sh\nexit 1' > $(BINDIR)/.have_strlcat ; chmod +x $(BINDIR)/.have_strlcat; }) |
| 86 | +endif |
| 87 | + |
| 88 | +$(shell $(BINDIR)/.have_strlcat) |
| 89 | +ifeq ($(.SHELLSTATUS), 0) |
| 90 | +FLAGS += -DHAVE_STRLCAT |
| 91 | +endif |
| 92 | + |
| 93 | +# Actual build recipes |
| 94 | + |
93 | 95 | CORE_CPP_FILES := \
|
94 | 96 | $(addprefix $(abspath $(CORE_PATH))/,\
|
95 | 97 | debug.cpp \
|
|
0 commit comments