bugmake - Bugs: bug #60165, Multiple pattern rules with single...

 
 

bug #60165: Multiple pattern rules with single rule

Submitter:  None
Submitted:  Wed 03 Mar 2021 09:24:53 PM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 19 Jul 2022 06:00:59 PM UTC, comment #1: 

The attached patch (if I understand it correctly) will break the large majority of makefiles that use pattern rules today, including even some built-in rules in GNU make.  It's clearly a non-starter from a backward-compatibility standpoint.

We implemented "&:" for explicit rules, to allow them to declare grouped targets: multiple targets generated by a single invocation of the recipe (this is how pattern rules ":") work.

We need to finish this by allowing a single definition of a pattern rule to create "exploded" rules: multiple pattern rules (the way explicit rules with ":" work).  But as above, we definitely can't do that by just changing the way pattern rules with ":" work.

Back when "&:" was suggested I had proposed using "|:" as a separator that means that one rule is created for each target.  That is, if you use "&:" (with any type of rule) you get grouped behavior.  If you use "|:" (with any type of rule) you get exploded behavior.  And if you use ":" without a specifier you get the "historical" behavior (exploded with explicit rules and grouped with pattern rules).

Paul D. Smith <psmith>
Group administrator
Wed 03 Mar 2021 09:24:53 PM UTC, original submission:  

To shorten the code, I would like to create multiple pattern rules with a single rule.

E.g. the code below is not working as desired.

$(BUILD)/$(FRONTEND)/%.html \
$(BUILD)/$(FRONTEND)/%.js   \
$(BUILD)/$(FRONTEND)/%.css  \
$(BUILD)/$(FRONTEND)/%.svg  \
$(BUILD)/$(FRONTEND)/%.ico:
@echo -n "$(FRONTEND) - building $@"
@$(MD) $(BUILD)/$(FRONTEND)
@cp $(FRONTEND)/$(@F) $@
@echo " ...done"

.PHONY:
login: $(BUILD)/$(FRONTEND)/login.html \
       $(BUILD)/$(FRONTEND)/login.js $(BUILD)/$(FRONTEND)/options.js $(BUILD)/$(FRONTEND)/node.js \
       $(BUILD)/$(FRONTEND)/login.css $(BUILD)/$(FRONTEND)/common.css \
       $(BUILD)/$(FRONTEND)/logo.svg \
       $(BUILD)/$(FRONTEND)/favicon.ico
@echo -n "$(FRONTEND) - building login"
@echo " ...done"

# result
# q@odysseus:~/ff$ make login
# frontend - building build/frontend/login.html ...done
# frontend - building build/frontend/options.js ...done
# frontend - building build/frontend/node.js ...done
# frontend - building build/frontend/common.css ...done
# frontend - building build/frontend/logo.svg ...done
# frontend - building build/frontend/favicon.ico ...done
# frontend - building login ...done
# q@odysseus:~/ff$ make login
# frontend - building build/frontend/login.js ...done
# frontend - building login ...done
# q@odysseus:~/ff$ make login
# frontend - building build/frontend/login.css ...done
# frontend - building login ...done

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #53452:  make.sv60165.patch added by jpoittevin (8KiB - text/x-patch - Patch proposition implementing SV 60165)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by jpoittevin (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-19 jpoittevin Attached File- Added make.sv60165.patch, #53452

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code