Browse Source

[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>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
02bf08bc1e
1 changed files with 60 additions and 21 deletions
  1. 60
    21
      src/Makefile.housekeeping

+ 60
- 21
src/Makefile.housekeeping View File

508
 $(BIN)/%.flags :
508
 $(BIN)/%.flags :
509
 	@$(ECHO) $(OBJ_CFLAGS)
509
 	@$(ECHO) $(OBJ_CFLAGS)
510
 
510
 
511
-# Device ID tables (using IDs extracted by parserom.pl)
512
-#
513
-define obj_pci_id_asm
514
-	.section ".pci_devlist.$(1)", "a", @progbits
515
-	.globl pci_devlist_$(1)
516
-pci_devlist_$(1):
517
-	.short ( 0x$(1) & 0xffff )
518
-
519
-endef
520
-define obj_isa_id_asm
521
-endef
522
-OBJ_IDS_ASM	= $(foreach ROM,$(ROMS_$(OBJECT)),$(call obj_$(ROM_TYPE_$(ROM))_id_asm,$(ROM)))
523
-OBJ_IDS_ASM_NL	= $(subst $(NEWLINE),\n,$(OBJ_IDS_ASM))
524
-$(BIN)/%.ids :
525
-	@$(ECHO_E) '$(OBJ_IDS_ASM_NL)'
526
-
527
 # ICC requires postprocessing objects to fix up table alignments
511
 # ICC requires postprocessing objects to fix up table alignments
528
 #
512
 #
529
 ifeq ($(CCTYPE),icc)
513
 ifeq ($(CCTYPE),icc)
781
 	$(Q)$(CPP) $(CFLAGS) $(CFLAGS_$(2)) $(CFLAGS_$(3)) -DOBJECT=$(3) \
765
 	$(Q)$(CPP) $(CFLAGS) $(CFLAGS_$(2)) $(CFLAGS_$(3)) -DOBJECT=$(3) \
782
 		-Wno-error -M $(1) -MG -MP | \
766
 		-Wno-error -M $(1) -MG -MP | \
783
 		sed 's/\.o\s*:/_DEPS +=/' > $(BIN)/deps/$(1).d
767
 		sed 's/\.o\s*:/_DEPS +=/' > $(BIN)/deps/$(1).d
784
-	$(Q)$(if $(findstring drivers/,$(1)),\
785
-	   $(PERL) $(PARSEROM) $(1) >> $(BIN)/deps/$(1).d)
786
 endef
768
 endef
787
 
769
 
788
 # rules_template : generate rules for a given source file
770
 # rules_template : generate rules for a given source file
801
 $$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)
783
 $$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS)
802
 	$$(QM)$(ECHO) "  [BUILD] $$@"
784
 	$$(QM)$(ECHO) "  [BUILD] $$@"
803
 	$$(RULE_$(2))
785
 	$$(RULE_$(2))
804
-BOBJS += $$(BIN)/$(3).o $(if $(ROMS_$(3)),$$(BIN)/$(3).ids.o)
786
+BOBJS += $$(BIN)/$(3).o
805
 $(foreach TGT,$(GENERIC_TARGETS),$(if $(RULE_$(2)_to_$(TGT)),$(NEWLINE)$(call rules_template_target,$(1),$(2),$(3),$(TGT))))
787
 $(foreach TGT,$(GENERIC_TARGETS),$(if $(RULE_$(2)_to_$(TGT)),$(NEWLINE)$(call rules_template_target,$(1),$(2),$(3),$(TGT))))
806
 $$(BIN)/deps/$(1).d : $$($(3)_DEPS)
788
 $$(BIN)/deps/$(1).d : $$($(3)_DEPS)
807
 TAGS : $$($(3)_DEPS)
789
 TAGS : $$($(3)_DEPS)
830
 
812
 
831
 # Generate the dependency files
813
 # Generate the dependency files
832
 #
814
 #
833
-$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
815
+$(BIN)/deps/%.d : % $(MAKEDEPS)
834
 	$(call deps_template_file,$<)
816
 	$(call deps_template_file,$<)
835
 
817
 
836
 # Calculate list of dependency files
818
 # Calculate list of dependency files
872
 endif
854
 endif
873
 endif
855
 endif
874
 
856
 
875
-# The following variables are created by the rules files
857
+# Files to be parsed using parserom.pl
858
+#
859
+ROM_SRCS	= $(foreach SRC,$(AUTO_SRCS),\
860
+		    $(if $(findstring drivers/,$(SRC)),$(SRC)))
861
+romsrcs :
862
+	@$(ECHO) $(ROM_SRCS)
863
+
864
+# List of files to be parsed using parserom.pl
865
+#
866
+ROM_SRCS_LIST	:= $(BIN)/.rom.list
867
+ifeq ($(wildcard $(ROM_SRCS_LIST)),)
868
+ROM_SRCS_OLD := <invalid>
869
+else
870
+ROM_SRCS_OLD := $(shell cat $(ROM_SRCS_LIST))
871
+endif
872
+ifneq ($(ROM_SRCS_OLD),$(ROM_SRCS))
873
+$(shell $(ECHO) "$(ROM_SRCS)" > $(ROM_SRCS_LIST))
874
+endif
875
+
876
+$(ROM_SRCS_LIST) : $(MAKEDEPS)
877
+
878
+VERYCLEANUP	+= $(ROM_SRCS_LIST)
879
+
880
+# ROM definition file
881
+#
882
+ROMDEFS		= $(BIN)/.rom.defs
883
+$(ROMDEFS) : $(ROM_SRCS) $(ROM_SRCS_LIST) $(PARSEROM) $(MAKEDEPS)
884
+	$(QM)$(ECHO) "  [PARSEROM]"
885
+	$(Q)$(PERL) $(PARSEROM) $(ROM_SRCS) > $@
886
+
887
+VERYCLEANUP	+= $(ROMDEFS)
888
+
889
+# Evaluate ROM definition file
890
+ifdef NEED_DEPS
891
+ifneq ($(ROM_SRCS),)
892
+-include $(ROMDEFS)
893
+endif
894
+endif
895
+
896
+# Device ID tables (using IDs from ROM definition file)
897
+#
898
+define obj_pci_id_asm
899
+	.section ".pci_devlist.$(1)", "a", @progbits
900
+	.globl pci_devlist_$(1)
901
+pci_devlist_$(1):
902
+	.short ( 0x$(1) & 0xffff )
903
+
904
+endef
905
+define obj_isa_id_asm
906
+endef
907
+OBJ_IDS_ASM	= $(foreach ROM,$(ROMS_$(OBJECT)),$(call obj_$(ROM_TYPE_$(ROM))_id_asm,$(ROM)))
908
+OBJ_IDS_ASM_NL	= $(subst $(NEWLINE),\n,$(OBJ_IDS_ASM))
909
+$(BIN)/%.ids :
910
+	@$(ECHO_E) '$(OBJ_IDS_ASM_NL)'
911
+
912
+BOBJS	+= $(patsubst %,$(BIN)/%.ids.o,$(DRIVERS))
913
+
914
+# The following variables are created by the autogenerated rules
876
 #
915
 #
877
 bobjs :
916
 bobjs :
878
 	@$(ECHO) $(BOBJS)
917
 	@$(ECHO) $(BOBJS)

Loading…
Cancel
Save