Re: [PATCH 2/4] Makefile: Replace explicit subdir rules with pattern rules

Simon Marchi
2016-11-15T18:41:54Z

On 2016-11-15 13:36, Pedro Alves wrote:
> On 11/15/2016 06:00 PM, Simon Marchi wrote:
>> On 2016-11-15 12:54, Pedro Alves wrote:
>>> On 11/13/2016 03:46 AM, Simon Marchi wrote:
>>>> # Need to explicitly specify the compile rule as make will do
>>>> nothing
>>>> # or try to compile the object file into the sub-directory.
>>>
>>> Do these comments need adjustment?
>>
>> I thought they were still true and relevant after the change. What do
>> you think?
>
> But should we at least merge them? Looking at your branch on github,
> we end up with:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> #
> # gdb/cli/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: $(srcdir)/cli/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> # GCC Compile support dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: $(srcdir)/compile/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> #
> # GDBTK sub-directory
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the mi directory.
>
> all-gdbtk: insight$(EXEEXT)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> The last one is strange, for talking about MI.
>
>
> And then a bit further below, we have the same comment several
> times again:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> #
> # gdb/mi/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: $(srcdir)/mi/%.c
> $(COMPILE) $<
>
> # gdb/common/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: ${srcdir}/common/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> common-agent.o: $(srcdir)/common/agent.c
> $(COMPILE) $(srcdir)/common/agent.c
> $(POSTCOMPILE)
>
> #
> # gdb/target/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: ${srcdir}/target/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> #
> # gdb/arch/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: ${srcdir}/arch/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> # gdb/nat/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: ${srcdir}/nat/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> #
> # gdb/tui/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: $(srcdir)/tui/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> # gdb/guile dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> %.o: $(srcdir)/guile/%.c
> $(COMPILE) $<
> $(POSTCOMPILE)
>
> # gdb/python/ dependencies
> #
> # Need to explicitly specify the compile rule as make will do nothing
> # or try to compile the object file into the sub-directory.
>
> # Flags needed to compile Python code
> PYTHON_CFLAGS=@PYTHON_CFLAGS@
>
> %.o: $(srcdir)/python/%.c
> $(COMPILE) $(PYTHON_CFLAGS) $<
> $(POSTCOMPILE)
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> I think a single comment talking about needing a compile rule for
> each subdir, might be clearer/simpler.
>
> Also, the cases that are exceptions I think would benefit
> from a comment, like e.g., the common-agent.o rule.
>
> Thanks,
> Pedro Alves

Agreed, I'll do the change in v2.

Thanks,

Simon