
Reilly Hayes wrote:
The rules in suffix.mk don't seem to work for building in $(TOP)/ compiler/stage1 when building from .hc files. Make dies complaining that it doesn't know how to build the .o file.
The relevant rules are:
-------- # with mangling
$(odir_)%.raw_s : %.hc $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. `echo $(patsubst - monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $ ($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'`
$(odir_)%.s : %.raw_s $(MANGLER) $< $@ $(patsubst -monly-%-regs, %, $(filter -monly-%- regs, $($*_HC_OPTS)))
$(odir_)%.o : %.s $(CC) -c -o $@ $< --------
The problem is that the dependency chain is broken when the source & build directory are different. Assuming that .raw_s and .s files belong in the build directory (stage1, etc), I believe the rules should look like:
-------- # with mangling
$(odir_)%.raw_s : %.hc $(CC) -x c $< -o $@ -S -O $(HC_BOOT_CC_OPTS) -I. `echo $(patsubst - monly-%-regs, -DSTOLEN_X86_REGS=%, $(filter -monly-%-regs, $ ($*_HC_OPTS))) | sed 's/^$$/-DSTOLEN_X86_REGS=4/'`
$(odir_)%.s : $(odir_)%.raw_s $(MANGLER) $< $@ $(patsubst -monly-%-regs, %, $(filter -monly-%- regs, $($*_HC_OPTS)))
$(odir_)%.o : $(odir_)%.s $(CC) -c -o $@ $< --------
Change committed, thanks. Cheers, Simon