Re: [PATCH] Beautify all & install Makefile targets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Damien Lespiau wrote:
> Beautify make's output like kbuild or git. The install
> target is especially much more readable.
> make V=1 (install) to get back to the old behaviour.

The Makefile currently doesn't require anything particularly special from
make, and in theory should work with any reasonable make, not just GNU make.
I hestitate to change that for purely aesthetic purposes.  The % rules seem
easy enough to replace with a suffix rule .c.o.  You can use substitution to
check V, like this:

josh@josh-mobile:/tmp$ cat Makefile 
V=@
Q=$(V:1=)
QUIET_SOMETHING=$(Q:@=@echo SOMETHING;)
#...

test:
        @echo V=$(V)
        @echo Q=$(Q)
        @echo QUIET_SOMETHING=$(QUIET_SOMETHING)
josh@josh-mobile:/tmp$ make
V=@
Q=@
QUIET_SOMETHING=@echo SOMETHING
josh@josh-mobile:/tmp$ make V=1
V=1
Q=
QUIET_SOMETHING=

You can write more rules of the form QUIET_SOMETHING=$(Q:@=value if quiet)

I'd also like to hear from other people on whether or not they prefer this
style of output.  It doesn't matter much to me either way.

> +	QUIET_LD       = @echo    '   ' LD'      '$@;

This always seems misleading to me, given that the corresponding rules run CC,
not LD.

> +	QUIET_INST_SH  = echo -n  '   ' INSTALL '';
> +	QUIET_INST     = @echo -n '   ' INSTALL '';

This doesn't appear to output the installed file; it took a minute to figure
out that install -v provides the output.  Could you add a comment about that?
Also, why not write these strings as (for example):

echo -n '    INSTALL '

? That seems cleaner than breaking the lines up into quoted whitespace and
unquoted text.

> +%.o: %.c
> +	$(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<

I think you can use $@ here rather than $*.o .  Also, as mentioned above, this
should become a suffix rule.

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux