# Without this, failed build products remain, with up-to-date timestamps, # thus tricking Make (and you!) into believing that All Is Well, in subsequent # make invocations:
.DELETE_ON_ERROR:
# Avoid accidental wrong builds, due to built-in rules working just a little # bit too well--but not quite as well as required for our situation here.
java.lang.NullPointerException # In other words, "make $SOME_TEST" is supposed to fail to build at all, # because this Makefile only supports either "make" (all), or"make /full/path". # However, the built-in rules, ifnot suppressed, will pick up CFLAGS and the # initial LDLIBS (but not the target-specific LDLIBS, because those are only # set for the full path target!). This causes it to get pretty far into building # things despite using incorrect values such as an *occasionally* incomplete # LDLIBS.
MAKEFLAGS += --no-builtin-rules
# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is # automatically enabled at -O1 or above. This triggers various unused-result # warnings where functions such as read() or write() are called and their # return value is not checked. Disable _FORTIFY_SOURCE to silence those # warnings.
CFLAGS += -U_FORTIFY_SOURCE
KDIR ?= /lib/modules/$(shell uname -r)/build
ifneq (,$(wildcard $(KDIR)/Module.symvers))
ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
TEST_GEN_MODS_DIR := page_frag else
PAGE_FRAG_WARNING = "missing page_frag_cache.h, please use a newer kernel"
endif else
PAGE_FRAG_WARNING = "missing Module.symvers, please have the kernel built first"
endif
# x86_64 users should be encouraged to install 32-bit libraries
ifeq ($(CAN_BUILD_I386)$(CAN_BUILD_X86_64),01)
all: warn_32bit_failure
warn_32bit_failure:
@echo "Warning: you seem to have a broken 32-bit build" 2>&1; \
echo "environment. This will reduce test coverage of 64-bit" 2>&1; \
echo "kernels. If you are using a Debian-like distribution," 2>&1; \
echo "try:"; 2>&1; \
echo ""; \
echo " apt-get install gcc-multilib libc6-i386 libc6-dev-i386"; \
echo ""; \
echo "If you are using a Fedora-like distribution, try:"; \
echo ""; \
echo " yum install glibc-devel.*i686"; \ exit 0;
endif
endif
# IOURING_EXTRA_LIBS may get set in local_config.mk, or it may be left empty.
$(OUTPUT)/cow: LDLIBS += $(IOURING_EXTRA_LIBS)