This reflects that REDIS_*FLAGS will only be used for compilation of Redis and not for its dependencies. Similarly, that FINAL_*FLAGS are composed of other variables and holds the options that are finally passed to the compiler and linker.
To do so, the Makefile stores the contents of the MALLOC environment variable in a file named .make-malloc. When the contents of this file and the MALLOC variable are not equal, it forces a rebuild of the Redis source tree. A side-effect of this change is that choosing an allocator can now be done using the single MALLOC variable instead of USE_TCMALLOC, USE_JEMALLOC and so forth. These variables continue to work for backwards compatibility.
This change moves the build instructions for dependencies to a separate Makefile in deps/. The ARCH environment variable is stored in a .make-arch file in the same directory as the Makefile. The contents of this file is read and compared to the current ARCH, and, on a mismatch triggers rebuilding the entire source tree. When file .make-arch exists and matches with ARCH from the environment, the dependencies are assumed to already be built. The new "clean" target only cleans the Redis source tree, not its dependencies. To clear the dependencies as well, the "distclean" target can be used.