bugmake - Bugs: bug #56301, Mandatory/Optional include files...


bug #56301: Mandatory/Optional include files and pattern rule with multi-targets

Submitted by:  Masahiro Yamada <masahiroy>
Submitted on:  Fri 10 May 2019 04:33:49 PM UTC  
Severity:  3 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 10 May 2019 04:33:49 PM UTC, original submission:  

I see a problem when
a pattern rule with multiple targets
are responsible for creating included files,
some of which are mandatory, and the
others are optional.

I attached two test cases.

Both of them include two files, inc_a.mk and inc_b.mk

The difference between the two is:

For Makefile1, inc_a.mk is optional, inc_b.mk is mandatory.
For Makefile2, inc_a.mk is mandatory, inc_b.mk is optional.

inc_a.mk and inc_b.mk are supposed to be
simultaneously created by a pattern rule
(but it always fails).

The behavior is completely different
between Makefile1 and Makefile2.

$ make -f Makefile1
Makefile1:1: starting
target in question: inc_b.mk
Makefile1:8: inc_b.mk: No such file or directory
make: *** [Makefile1;12: inc_b.mk] Error 1

Make was terminated immediately when
it failed to create inc_b.mk

$ make -f Makefile2
Makefile2:1: starting
target in question: inc_b.mk
make: Failed to remake makefile 'inc_a.mk'.

This also failed to create included files,
and showed "Failed to remake" message,
but continued running, then executed the 'all' target.

I think the reason is the target in question
in the pattern rule is inc_b.mk, which is
an optional include file.

As far as I examined, the last included file
becomes the target in question of the pattern rule.

So, I see some sort of sense in this behavior.

However, Makefile2 failed to create the mandatory
include file, inc_a.mk, so Make cannot (should not)
continue parsing the Makefile.

One way to fix this is,
the target in question should be chosen
from mandatory include files over optional ones.

Masahiro Yamada <masahiroy>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #46891:  Makefile1 added by masahiroy (163B - application/octet-stream)
file #46892:  Makefile2 added by masahiroy (163B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by masahiroy (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-10 masahiroy Attached File- => Added Makefile1, #46891
        Attached File- => Added Makefile2, #46892

    Back to the top

    Powered by Savane 3.5