On 02/18/17 00:37, Bruce Korb wrote: > On 02/06/17 10:44, Bernd Edlinger wrote: >> I tested this change with different arm-linux-gnueabihf cross >> compilers, and verified that mkheaders still works on the host system. >> >> Bootstrapped and reg-tested on x86_64-pc-linux-gnu. >> Is it OK for trunk? > > As long as you certify that this is correct for all systems we care about: > > +BUILD_SYSTEM_HEADER_DIR = ` > + echo $(CROSS_SYSTEM_HEADER_DIR) | \ > + sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` > > that is pretty obtuse sed-speak to me. I suggest a comment > explaining what sed is supposed to be doing. What should > "$(CROSS_SYSTEM_HEADER_DIR)" look like? >
I took it just from a few lines above, so I thought that comment would sufficiently explain the syntax: # autoconf sets SYSTEM_HEADER_DIR to one of the above. # Purge it of unnecessary internal relative paths # to directories that might not exist yet. # The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. # Use single quotes here to avoid nested double- and backquotes, this # macro is also used in a double-quoted context. SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` But I guess it would not hurt to just repeat "Purge it of unnecessary internal relative paths" here as well. CROSS_SYSTEM_HEADER_DIR is where the target system headers are located on the build system (IOW the system root), that can be something like "CROSS_SYSTEM_HEADER_DIR = $(gcc_tooldir)/sys-include" Which may expand to something like that: "/home/ed/gnu/arm-linux-gnueabihf-cross/lib/gcc/arm-linux-gnueabihf/7.0.1/../../../../arm-linux-gnueabihf/sys-include" which the sed script changes then to "/home/ed/gnu/arm-linux-gnueabihf-cross/arm-linux-gnueabihf/sys-include" And in deed, I have put the target header files there on the build machine. But on the target system the include files are simply at "/usr/include" which is the value of SYSTEM_HEADER_DIR, thus SYSTEM_HEADER_DIR is not a path where the headers are visible at the build system, only code that executes on the target system should use SYSTEM_HEADER_DIR. Thanks Bernd.