On Tue, Sep 04, 2018 at 01:04:31PM -0400, Wei Huang wrote: > > > +parse-cross-prefix = $(subst gcc,,$(patsubst cc,gcc,$(patsubst > > > CROSS_CC_GUEST="%",%,$(shell grep "CROSS_CC_GUEST=" > > > $(SRC_PATH)/$(1)-softmmu/config-target.mak)))) > > > +gen-cross-prefix = $(patsubst %-,CROSS_PREFIX=%-,$(call > > > parse-cross-prefix,$(1))) > > > > > > -x86.bootsect: x86.boot > > > - dd if=$< of=$@ bs=256 count=2 skip=124 > > > +.PHONY: all $(TARGET_LIST) > > > > > > -x86.boot: x86.o > > > - $(CROSS_PREFIX)objcopy -O binary $< $@ > > > +all: $(TARGET_LIST) > > > > > > -x86.o: x86-a-b-bootblock.S > > > - $(CROSS_PREFIX)gcc -m32 -march=i486 -c $< -o $@ > > > +$(TARGET_LIST): > > > + $(MAKE) -C $@ $(call gen-cross-prefix,$@) > > > > > > clean: > > > - @rm -rf *.boot *.o *.bootsect > > > + for target in $(TARGET_LIST); do \ > > > + $(MAKE) -C $$target clean; \ > > > + done > > > > The above seems overly complicated. Does the following work? > > > > $(TARGET_LIST): CROSS_PREFIX=$(CROSS_CC_GUEST) > > $(TARGET_LIST): > > $(MAKE) -C $@ > > No, it doen't work for different reasons. > > First, to have CROSS_CC_GUEST defined, we normally would use "-include" to > include config-target.mak file. But the end result is, the CROSS_CC_GUEST > only has the same definition for both architectures (due to make command's > multi-iteration processing and include is processed first). Secondly, > CROSS_CC_GUEST needs to be polished because it can be: i) not defined; ii) > "cc" without prefix; or iii) used-define value. We can't use it directly. >
OK. Since I don't have any better suggestions. Then this is good enough for me. Thanks, drew