mirror of https://github.com/ipxe/ipxe.git
[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>pull/36/head
parent
dac866b066
commit
02bf08bc1e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue