[ccan] [PATCH v2 12/13] Makefile: Define CFLAGS_FORCE_C_SOURCE macro

David Gibson david at gibson.dropbear.id.au
Tue Sep 27 15:18:50 AEST 2016


On Thu, Sep 22, 2016 at 09:33:15PM -0600, Kevin Locke wrote:
> This macro holds the C compiler flag(s) to force input files to be
> recognized as C sources regardless of extension.  It is defined to allow
> overriding on the make command line.
> 
> Signed-off-by: Kevin Locke <kevin at kevinlocke.name>

So.. this approach works.

But I've been wondering for a while if the weird thing we do of having
the _info files not have a .c extension is a good idea.

I think the underscore enough is probably enough to mark those
special, so things might be less messy if we just called them _info.c.

Rusty, thoughts?

> ---
>  Makefile      | 2 +-
>  Makefile-ccan | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 127b875..37ff17d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -64,7 +64,7 @@ summary-fastcheck/%: tools/ccanlint/ccanlint $(OBJFILES)
>  	$(CCANLINT_FAST) -s ccan/$*
>  
>  ccan/%/info: ccan/%/_info config.h
> -	$(CC) $(CCAN_CFLAGS) -I. -o $@ -x c $<
> +	$(CC) $(CCAN_CFLAGS) -I. -o $@ $(CFLAGS_FORCE_C_SOURCE) $<
>  
>  all_info: $(MODS:%=ccan/%/info)
>  
> diff --git a/Makefile-ccan b/Makefile-ccan
> index 5c8dea2..d4a5528 100644
> --- a/Makefile-ccan
> +++ b/Makefile-ccan
> @@ -5,6 +5,7 @@
>  #CCAN_CFLAGS=-g -O3 -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wundef -DCCAN_STR_DEBUG=1
>  CCAN_CFLAGS=-g3 -ggdb -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -Wundef -DCCAN_STR_DEBUG=1
>  CFLAGS = $(CCAN_CFLAGS) -I. $(DEPGEN)
> +CFLAGS_FORCE_C_SOURCE = -x c
>  
>  MODS := a_star \
>  	aga \

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/ccan/attachments/20160927/0c6d5714/attachment-0001.sig>


More information about the ccan mailing list