On Tue, Jun 22, 2010 at 10:01:36PM +0800, Liu, Jinsong wrote:
> > Something like the below didn't work?
> > (I just wrote it just to show my idea. I didn't any test.)
> >
> > +src/%.hex: src/acpi-ssdt.dsl src/mk_ssdt.c
> > + @echo "Compiling SSDT for general os which support more cpus"
> > + $(Q)$(CC) -o mk_$* src/mk_ssdt.c
> > + head -n -2 $< > src/$*.dsl.i
> > + ./mk_$* >> src/$*.dsl.i
> > + $(Q)cpp -P src/$*.dsl.i > src/$*.dsl
> > + $(Q)iasl -tc -p $@ src/acpi-ssdt-anycpu.dsl
> > + $(Q)sed -i -e 's/AmlCode/$*/g' $@
> > + $(Q)rm mk_$* src/$*.dsl.i src/$*.aml src/$*.dsl
> >
>
> If so, current dependency 'src/%.hex: src/%.dsl' will conflict with new dependency 'src/%.hex: src/acpi-ssdt.dsl src/mk_ssdt.c', like when build src/acpi-ssdt.hex?
>
Ah, then src/acpi-ssdt-%.hex doesn't work?
Anyway if automatic variable doesn't work for what you want or
you want more generic method, canned command sequence would work.
This technique is already used. Linux kbuild uses it very heavily.
ssdt-compile = ...
(or use define/endef)
src/acpi-anycpu.hex: ...
$(ssdt-compile)
If you want to pass parameter
src/acpi-15cpu.hex: ...
$(call ssdt-compile parameter, ...)
> BTW, in current Makefile, seems the dependency '$(OUT)ccode32flat.o: src/acpi-dsdt.hex' is redundant.
> Without it, makefile still build src/acpi-dsdt.hex. I checked the Makefile but didn't find the reason.
It's subtle dependency. Without the dependency,
"make clean; rm -f src/acpi-dsdt.hex; make" causes the following
error for me. I suspect that old acpi-dsdt.hex would be used even when
acpi-dsdt.dsl is modified.
Hmm, should it be commented?
Working around non-functional -combine
Compiling whole program out/ccode.16.s
Compiling to assembler out/asm-offsets.s
Generating offset file out/asm-offsets.h
Compiling (16bit) out/code16.o
Compiling whole program out/ccode32flat.o
In file included from out/ccode32flat.o.tmp.c:39:
out/../src/acpi.c:205:25: error: acpi-dsdt.hex: No such file or directory
In file included from out/ccode32flat.o.tmp.c:39:
out/../src/acpi.c: In function 'acpi_bios_init':
out/../src/acpi.c:690: error: 'AmlCode' undeclared (first use in this function)
out/../src/acpi.c:690: error: (Each undeclared identifier is reported only once
out/../src/acpi.c:690: error: for each function it appears in.)
make: *** [out/ccode32flat.o] Error 1
--
yamahata