Include Makefile in another Makefile only if exists
This snippet allows you to include the contents of a Makefile located in a folder in the root Makefile.
MAKEFILE_FOLDER := ./vendor/FOLDER THAT CONTAINS MAKEFILE exist := $(wildcard $(MAKEFILE_FOLDER)/Makefile) ifneq ($(strip $(exist)),) include $(MAKEFILE_FOLDER)/Makefile endif
DIR_TO_CHECK_FOR = 'large_directory' download_data: ifeq ("$(wildcard $(DIR_TO_CHECK_FOR))", "") @echo "Directory does not exist." # Perform download... else @echo "Skipping download because directory already exists." endif