]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Use a single call to parserom.pl to speed up building
authorMichael Brown <mcb30@ipxe.org>
Sat, 18 Apr 2015 10:21:45 +0000 (11:21 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sat, 18 Apr 2015 15:11:21 +0000 (16:11 +0100)
Inspired-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/Makefile.housekeeping

index f0a569dfe297aa2830fb702863ebe90de2bcd67a..51d71f1343eafc78fdcf1d62e7b2b62fcd7d5e7d 100644 (file)
@@ -508,22 +508,6 @@ OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
 $(BIN)/%.flags :
        @$(ECHO) $(OBJ_CFLAGS)
 
-# Device ID tables (using IDs extracted by parserom.pl)
-#
-define obj_pci_id_asm
-       .section ".pci_devlist.$(1)", "a", @progbits
-       .globl pci_devlist_$(1)
-pci_devlist_$(1):
-       .short ( 0x$(1) & 0xffff )
-
-endef
-define obj_isa_id_asm
-endef
-OBJ_IDS_ASM    = $(foreach ROM,$(ROMS_$(OBJECT)),$(call obj_$(ROM_TYPE_$(ROM))_id_asm,$(ROM)))
-OBJ_IDS_ASM_NL = $(subst $(NEWLINE),\n,$(OBJ_IDS_ASM))
-$(BIN)/%.ids :
-       @$(ECHO_E) '$(OBJ_IDS_ASM_NL)'
-
 # ICC requires postprocessing objects to fix up table alignments
 #
 ifeq ($(CCTYPE),icc)
@@ -781,8 +765,6 @@ define deps_template_parts
        $(Q)$(CPP) $(CFLAGS) $(CFLAGS_$(2)) $(CFLAGS_$(3)) -DOBJECT=$(3) \
                -Wno-error -M $(1) -MG -MP | \
                sed 's/\.o\s*:/_DEPS +=/' > $(BIN)/deps/$(1).d
-       $(Q)$(if $(findstring drivers/,$(1)),\
-          $(PERL) $(PARSEROM) $(1) >> $(BIN)/deps/$(1).d)
 endef
 
 # rules_template : generate rules for a given source file
@@ -801,7 +783,7 @@ define rules_template_parts
 $$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)
        $$(QM)$(ECHO) "  [BUILD] $$@"
        $$(RULE_$(2))
-BOBJS += $$(BIN)/$(3).o $(if $(ROMS_$(3)),$$(BIN)/$(3).ids.o)
+BOBJS += $$(BIN)/$(3).o
 $(foreach TGT,$(GENERIC_TARGETS),$(if $(RULE_$(2)_to_$(TGT)),$(NEWLINE)$(call rules_template_target,$(1),$(2),$(3),$(TGT))))
 $$(BIN)/deps/$(1).d : $$($(3)_DEPS)
 TAGS : $$($(3)_DEPS)
@@ -830,7 +812,7 @@ endef
 
 # Generate the dependency files
 #
-$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
+$(BIN)/deps/%.d : % $(MAKEDEPS)
        $(call deps_template_file,$<)
 
 # Calculate list of dependency files
@@ -872,7 +854,64 @@ endif
 endif
 endif
 
-# The following variables are created by the rules files
+# Files to be parsed using parserom.pl
+#
+ROM_SRCS       = $(foreach SRC,$(AUTO_SRCS),\
+                   $(if $(findstring drivers/,$(SRC)),$(SRC)))
+romsrcs :
+       @$(ECHO) $(ROM_SRCS)
+
+# List of files to be parsed using parserom.pl
+#
+ROM_SRCS_LIST  := $(BIN)/.rom.list
+ifeq ($(wildcard $(ROM_SRCS_LIST)),)
+ROM_SRCS_OLD := <invalid>
+else
+ROM_SRCS_OLD := $(shell cat $(ROM_SRCS_LIST))
+endif
+ifneq ($(ROM_SRCS_OLD),$(ROM_SRCS))
+$(shell $(ECHO) "$(ROM_SRCS)" > $(ROM_SRCS_LIST))
+endif
+
+$(ROM_SRCS_LIST) : $(MAKEDEPS)
+
+VERYCLEANUP    += $(ROM_SRCS_LIST)
+
+# ROM definition file
+#
+ROMDEFS                = $(BIN)/.rom.defs
+$(ROMDEFS) : $(ROM_SRCS) $(ROM_SRCS_LIST) $(PARSEROM) $(MAKEDEPS)
+       $(QM)$(ECHO) "  [PARSEROM]"
+       $(Q)$(PERL) $(PARSEROM) $(ROM_SRCS) > $@
+
+VERYCLEANUP    += $(ROMDEFS)
+
+# Evaluate ROM definition file
+ifdef NEED_DEPS
+ifneq ($(ROM_SRCS),)
+-include $(ROMDEFS)
+endif
+endif
+
+# Device ID tables (using IDs from ROM definition file)
+#
+define obj_pci_id_asm
+       .section ".pci_devlist.$(1)", "a", @progbits
+       .globl pci_devlist_$(1)
+pci_devlist_$(1):
+       .short ( 0x$(1) & 0xffff )
+
+endef
+define obj_isa_id_asm
+endef
+OBJ_IDS_ASM    = $(foreach ROM,$(ROMS_$(OBJECT)),$(call obj_$(ROM_TYPE_$(ROM))_id_asm,$(ROM)))
+OBJ_IDS_ASM_NL = $(subst $(NEWLINE),\n,$(OBJ_IDS_ASM))
+$(BIN)/%.ids :
+       @$(ECHO_E) '$(OBJ_IDS_ASM_NL)'
+
+BOBJS  += $(patsubst %,$(BIN)/%.ids.o,$(DRIVERS))
+
+# The following variables are created by the autogenerated rules
 #
 bobjs :
        @$(ECHO) $(BOBJS)