summaryrefslogtreecommitdiffstats
path: root/src/Makefile.housekeeping
diff options
context:
space:
mode:
authorMichael Brown2015-04-18 12:21:45 +0200
committerMichael Brown2015-04-18 17:11:21 +0200
commit02bf08bc1e75e84fb3b69ea6e71fba9e47543a49 (patch)
tree1866b1eb8ae6b0a5c77e47779e4e512668c983da /src/Makefile.housekeeping
parent[build] Work around binutils quirk on OpenBSD 5.7 (diff)
downloadipxe-02bf08bc1e75e84fb3b69ea6e71fba9e47543a49.tar.gz
ipxe-02bf08bc1e75e84fb3b69ea6e71fba9e47543a49.tar.xz
ipxe-02bf08bc1e75e84fb3b69ea6e71fba9e47543a49.zip
[build] Use a single call to parserom.pl to speed up building
Inspired-by: Robin Smidsrød <robin@smidsrod.no> Tested-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/Makefile.housekeeping')
-rw-r--r--src/Makefile.housekeeping81
1 files changed, 60 insertions, 21 deletions
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index f0a569df..51d71f13 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -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)