env: net: U_BOOT_ENV_CALLBACKs should not depend on CMD_NET
[oweals/u-boot.git] / scripts / Makefile.build
index 06e5c203c1f13bd4428ef16c2151e9345e07c0ef..f7a041296d3d9972d3a9a933c1dd0267f4b3aa9c 100644 (file)
@@ -1,9 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
 # ==========================================================================
 # Building
 # ==========================================================================
-#
-# SPDX-License-Identifier:     GPL-2.0
-#
 
 # Modified for U-Boot
 prefix := tpl
@@ -333,8 +331,6 @@ quiet_cmd_asn1_compiler = ASN.1   $@
       cmd_asn1_compiler = $(objtree)/scripts/asn1_compiler $< \
                                $(subst .h,.c,$@) $(subst .c,.h,$@)
 
-.PRECIOUS: $(objtree)/$(obj)/%-asn1.c $(objtree)/$(obj)/%-asn1.h
-
 $(obj)/%-asn1.c $(obj)/%-asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
        $(call cmd,asn1_compiler)
 
@@ -417,6 +413,17 @@ $(call multi_depend, $(multi-used-m), .o, -objs -y)
 targets += $(multi-used-y) $(multi-used-m)
 
 
+# Add intermediate targets:
+# When building objects with specific suffix patterns, add intermediate
+# targets that the final targets are derived from.
+intermediate_targets = $(foreach sfx, $(2), \
+                               $(patsubst %$(strip $(1)),%$(sfx), \
+                                       $(filter %$(strip $(1)), $(targets))))
+# %.lex.o <- %.lex.c <- %.l
+# %.tab.o <- %.tab.[ch] <- %.y
+targets += $(call intermediate_targets, .lex.o, .lex.c) \
+          $(call intermediate_targets, .tab.o, .tab.c .tab.h)
+
 # Descending
 # ---------------------------------------------------------------------------