
Hello,
I am having a problem building the u-boot tools directory on a Mac. I have been doing some troubleshooting this afternoon but haven't quite been able to find a solution that doesn't break somewhere else.
The make utility and I have a long distaste for each other, even though I realize it is a necessary evil. I hoping that someone can follow several tests I generated below to help explain the behavior.
If I run make tools¹ (with gnu make version 3.81) it hums along shortly and then bombs out:
make -C tools all cc -Wall -pedantic -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include2 -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include -I /Users/garycarlson/Documents/Embedded/u-boot-at91/libfdt -I /Users/garycarlson/Documents/Embedded/u-boot-at91/tools -DTEXT_BASE=0x23f00000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -O -c -o crc32.o crc32.c i686-apple-darwin9-gcc-4.0.1: crc32.c: No such file or directory
No big surprise there, since crc32.c is not in the tools directory but rather in the lib_generic directory. I would expect the compiler syntax as emitted above to fail. However the make file located in the tools directory has a rule to address this that seems to be ignored:
$(obj)%.o: $(SRCTREE)/lib_generic/%.c $(CC) -g $(CFLAGS) -c -o $@ $<
Now if I create a test rule for troubleshooting purposes that replaces the pattern substitution with a hardcoded rule, it works differently:
$(obj)crc32.o: $(SRCTREE)/lib_generic/crc32.c $(CC) -g $(CFLAGS) -c -o $@ $<
This results in at least the crc32.c file compiling cleanly (the remaining files like md5, etc. that are not covered by the test rule still fail of course):
make -C tools all cc -g -Wall -pedantic -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include2 -idirafter /Users/garycarlson/Documents/Embedded/u-boot-at91/include -I /Users/garycarlson/Documents/Embedded/u-boot-at91/libfdt -I /Users/garycarlson/Documents/Embedded/u-boot-at91/tools -DTEXT_BASE=0x23f00000 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES -O -c -o crc32.o /Users/garycarlson/Documents/Embedded/u-boot-at91/lib_generic/crc32.c
Note that the crc32.c file is now referenced to the correct directory. My first instinct is to want to blame this as bug in the make tool, but given that it isn't one of my strengths, maybe someone else will see something that I don't! :)
Thanks,
Gary