diff options
Diffstat (limited to 'qemu/roms/ipxe/src/Makefile.housekeeping')
-rw-r--r-- | qemu/roms/ipxe/src/Makefile.housekeeping | 131 |
1 files changed, 79 insertions, 52 deletions
diff --git a/qemu/roms/ipxe/src/Makefile.housekeeping b/qemu/roms/ipxe/src/Makefile.housekeeping index 1a75d3939..03800c8ef 100644 --- a/qemu/roms/ipxe/src/Makefile.housekeeping +++ b/qemu/roms/ipxe/src/Makefile.housekeeping @@ -157,17 +157,6 @@ SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector') WORKAROUND_CFLAGS += $(SP_FLAGS) endif -# Some widespread patched versions of gcc include -fPIE -Wl,-pie by -# default. Note that gcc will exit *successfully* if it fails to -# recognise an option that starts with "no", so we have to test for -# output on stderr instead of checking the exit status. -# -ifeq ($(CCTYPE),gcc) -PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ] -PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie') -WORKAROUND_CFLAGS += $(PIE_FLAGS) -endif - # gcc 4.4 generates .eh_frame sections by default, which distort the # output of "size". Inhibit this. # @@ -533,6 +522,7 @@ endif # COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS) RULE_c = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O) +RULE_c_to_ids.o = $(Q)$(ECHO_E) '$(OBJ_IDS_ASM_NL)' | $(ASSEMBLE_S) -o $@ RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -DDBGLVL_MAX=$* -c $< -o $@ $(POST_O) RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@ RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@ @@ -543,7 +533,7 @@ RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@ RULE_S_to_dbg%.o = $(Q)$(PREPROCESS_S) -DDBGLVL_MAX=$* $< | $(ASSEMBLE_S) -o $@ RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@ -DEBUG_TARGETS += dbg%.o c s +GENERIC_TARGETS += ids.o dbg%.o c s # List of embedded images included in the last build of embedded.o. # This is needed in order to correctly rebuild embedded.o whenever the @@ -775,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 @@ -796,7 +784,7 @@ $$(BIN)/$(3).o : $(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(3)_DEPS) $$(QM)$(ECHO) " [BUILD] $$@" $$(RULE_$(2)) BOBJS += $$(BIN)/$(3).o -$(foreach TGT,$(DEBUG_TARGETS),$(if $(RULE_$(2)_to_$(TGT)),$(NEWLINE)$(call rules_template_target,$(1),$(2),$(3),$(TGT)))) +$(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) endef @@ -824,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 @@ -866,10 +854,69 @@ 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) +drivers_% : + @$(ECHO) $(DRIVERS_$*) drivers : @$(ECHO) $(DRIVERS) .PHONY : drivers @@ -900,6 +947,11 @@ $(BIN)/NIC : $(AUTO_DEPS) @perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@ CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern +# Select drivers to be included in the all-drivers build +# +DRIVERS_ipxe = $(DRIVERS_net) $(DRIVERS_infiniband) \ + $(DRIVERS_xen) $(DRIVERS_hyperv) + # Analyse a target name (e.g. "bin/dfe538--prism2_pci.rom.tmp") and # derive the variables: # @@ -908,7 +960,6 @@ CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern # TGT_DRIVERS : the driver for each element (e.g. "rtl8139 prism2_pci") # TGT_ROM_NAME : the ROM name (e.g. "dfe538") # -DRIVERS_ipxe = $(DRIVERS) CARD_DRIVER = $(firstword $(DRIVER_$(1)) $(1)) TGT_ELEMENTS = $(subst --, ,$(firstword $(subst ., ,$(notdir $@)))) TGT_ROM_NAME = $(firstword $(TGT_ELEMENTS)) @@ -941,6 +992,8 @@ TGT_PCI_DEVICE = $(PCI_DEVICE_$(TGT_ROM_NAME)) TGT_LD_DRIVERS = $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS))) TGT_LD_IDS = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \ pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0) +TGT_LD_DEVLIST = $(foreach ELEM,$(TGT_ELEMENTS),$(if $(PCI_VENDOR_$(ELEM)),\ + pci_devlist_$(patsubst 0x%,%,$(PCI_VENDOR_$(ELEM)))$(patsubst 0x%,%,$(PCI_DEVICE_$(ELEM))))) TGT_LD_ENTRY = _$(TGT_PREFIX)_start # Calculate linker flags based on link-time options for the current @@ -951,7 +1004,8 @@ TGT_LD_ENTRY = _$(TGT_PREFIX)_start # "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci # --defsym pci_vendor=0x1186 --defsym pci_device=0x1300") # -TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) obj_config,\ +TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) \ + $(TGT_LD_DEVLIST) obj_config,\ -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \ $(patsubst %,--defsym %,$(TGT_LD_IDS)) \ -e $(TGT_LD_ENTRY) @@ -981,6 +1035,7 @@ $(BIN)/%.info : @$(ECHO) @$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)' @$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)' + @$(ECHO) 'LD devlist symbols : $(TGT_LD_DEVLIST)' @$(ECHO) 'LD entry point : $(TGT_LD_ENTRY)' @$(ECHO) @$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)' @@ -1012,7 +1067,7 @@ BLIB = $(BIN)/blib.a $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS) $(Q)$(RM) $(BLIB) $(QM)$(ECHO) " [AR] $@" - $(Q)$(AR) r $@ $(BLIB_OBJS) + $(Q)$(AR) r $@ $(sort $(BLIB_OBJS)) $(Q)$(RANLIB) $@ blib : $(BLIB) @@ -1231,15 +1286,12 @@ endif # defined(BIN) # # The compression utilities # -$(NRV2B) : util/nrv2b.c $(MAKEDEPS) - $(QM)$(ECHO) " [HOSTCC] $@" - $(Q)$(HOST_CC) $(HOST_CFLAGS) -DENCODE -DDECODE -DMAIN -DVERBOSE \ - -DNDEBUG -DBITSIZE=32 -DENDIAN=0 -o $@ $< -CLEANUP += $(NRV2B) -$(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS) +ZBIN_LDFLAGS := -llzma + +$(ZBIN) : util/zbin.c $(MAKEDEPS) $(QM)$(ECHO) " [HOSTCC] $@" - $(Q)$(HOST_CC) $(HOST_CFLAGS) -o $@ $< + $(Q)$(HOST_CC) $(HOST_CFLAGS) $< $(ZBIN_LDFLAGS) -o $@ CLEANUP += $(ZBIN) ############################################################################### @@ -1319,31 +1371,6 @@ endif ############################################################################### # -# Auto-incrementing build serial number. Append "bs" to your list of -# build targets to get a serial number printed at the end of the -# build. Enable -DBUILD_SERIAL in order to see it when the code runs. -# -BUILDSERIAL_H = config/.buildserial.h -BUILDSERIAL_NOW = config/.buildserial.now -BUILDSERIAL_NEXT = config/.buildserial.next - -$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) : - $(ECHO) 1 > $@ - -$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) - $(ECHO) '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@ - -ifeq ($(filter bs,$(MAKECMDGOALS)),bs) -$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \ - cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW)) -endif - -bs : $(BUILDSERIAL_NOW) - @$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT) - @$(ECHO) "Build serial number is $(shell cat $<)" - -############################################################################### -# # Build the TAGS file(s) for emacs # TAGS : |