Subject: Re: [PATCH v2] abspath.h file is generated by makeheaders tool

From: Đoàn Trần Công Danh <[email-masked]>
Date: Sun, 16 Oct 2022 20:13:45 +0700

On 2022-10-13 16:40:32+0000, skrab-sah via GitGitGadget <[email-masked]> wrote:
> From: skrab-sah <[email-masked]>
> 
> 1. We don't need to commit the file.
> 2. Added routin for abspath.c in Makefile.
> 3. Added tool support for makeheaders.
> 
> Signed-off-by: skrab-sah <[email-masked]>
> ---

[...]

> diff --git a/Makefile b/Makefile
> index cac3452edb9..e1136e96283 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,6 +1,16 @@
>  # The default target of this Makefile is...
>  all::
>  
> +# compile header
> +.PHONY: hdr
> +hdr:: abspath.h
> +
> +makeheaders: tools/makeheaders.c
> +	$(CC) -o $@ $<
> +
> +abspath.h: abspath.c makeheaders
> +	./makeheaders $<

This will break cross-compilation.
At the very least, we needs to use either HOSTCC (likes linux project),
HOST_CC or CC_FOR_BUILD (GNU Autotools' convention) to compile
makeheaders

So, something like (not tested, whatsoever):

	CC_FOR_BUILD = $(CC)
	CFLAGS_FOR_BUILD = $(CFLAGS)
	LDFLAGS_FOR_BUILD = $(LDFLAGS)
	QUIET_HOSTCC = echo '	' HOSTCC $@;
	QUIET_MAKEHEADERS = echo '	' MAKEHEADERS $@;
	
	makeheaders: tools/makeheaders.c
		$(QUIET_HOSTCC)$(CC_FOR_BUILD) -o $@ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $<

	abspath.h: abspath.c makeheaders
		$(QUIET_MAKEHEADERS)./makeheaders $<

-- 
Danh