Created
February 17, 2023 14:21
-
-
Save bukowa/d5aae7c7415085355dfea238e5c177ba to your computer and use it in GitHub Desktop.
supress silence quiet Makefile warning: overriding commands for target warning: ignoring old commands for target
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile utility for including other Makefiles only once | |
# Function that includes a Makefile if it hasn't been included before | |
# | |
# Usage: | |
# $(call include_makefile_once, <filename>) | |
# | |
# where <filename> is the name of the Makefile to include | |
define include_makefile_once | |
ifeq ($(filter %$(1),$(MAKEFILE_LIST)),) | |
include $(1) | |
endif | |
endef | |
# Macro that includes multiple Makefiles only once | |
# | |
# Usage: | |
# $(call include_makefiles_once, <filenames>) | |
# | |
# where <filenames> is a space-separated list of filenames to include | |
# | |
# Example: | |
# $(call include_makefiles_once, git.mk otherlib.mk thirdlib.mk) | |
# | |
# This will include the Makefiles git.mk, otherlib.mk, and thirdlib.mk | |
# only once each, if they exist. | |
define include_makefiles_once | |
$(foreach FILE,$(1),$(eval $(call include_makefile_once,$(FILE)))) | |
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include lib/include.mk | |
MAKEFILES_INCLUDES = help.mk print.mk git.mk | |
$(call include_makefiles_once,$(MAKEFILES_INCLUDES)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment