Hi, Here's some planning for getting most files compiled as few times as possible. Comments and suggestions are welcome.
I have now converted most of the easy cases which were compiled for all targets, saving about 200 compiles for full build with default set of targets (~1500 files compiled). For the easy files, the rules can be just moved from Makefile.target to Makefile.objs without impact. If the file was compiled conditionally, the rules may need to be added to default-configs/*.mak. Some defines, like TARGET_PAGE_SIZE or TARGET_WORDS_BIGENDIAN can be pushed to board level. The target dependent cases should be next. On full build, each MIPS device file gets compiled four times, PPC files three times and x86 twice. The devices for architectures that are compiled only once (ARM, Cris, Sparc32 etc.) do not need to be touched. I think it's better to add a new line for each device to default-configs instead of adding just CONFIG_MIPS for example. The harder cases are those where the device code depends somehow on the architecture. Some thoughts follow. vl.c: a lot of work. Maybe the CPUState stuff should be separated to a new file. virtio-*.c: push TARGET_PAGE_SIZE to board level, it's not so easy though. rtl8139.c, e1000.c: need to convert ldl/stl to cpu_physical_memory_read/write. ide/core.c: win2k flag could be passed from board level, or the code could just be enabled here because the flag is x86 only in vl.c. pckbd.c, vmmouse.c, x86 CPU: On x86 only, vmmouse wants to insert key events to pckbd buffer and pckbd is connected to x86 A20 line. The solution could be to use qemu_irq signals to handle A20 line changes and some code reorganization. dma.c: DMA_schedule needs access to CPUState. mc146818.c: coalesced IRQs only for x86, also APIC dependency. fpu/softfloat.c, fpu/softfloat-native.c: may need some #define adjustment.