On Sun, 2018-10-07 at 09:01 -0400, Paul Smith wrote:
>   $(MAKE_DIR)/$$(MODULE): ; mkdir -p $@
> 
> (note the extra "$" when referencing the MODULE variable)

Actually I'm mistaken here: there's no secondary expansion for targets.

You might be able to write this as:

  $(MAKE_DIR)/%.mk: $(SRC_DIR)/%.m4 | $(MAKE_DIR)/$$(MODULE)/.; m4 $< $@
  $(MAKE_DIR)/%/. : ; mkdir -p $@

but I'm not sure (untested).

Another option, obviously, is to simply put the mkdir inside the recipe
(that's how I'd personally do it):

  $(MAKE_DIR)/%.mk: $(SRC_DIR)/%.m4
          mkdir -p $(MAKE_DIR)/$(MODULE)
          m4 $< $@

It may run extra instances of mkdir but I doubt it will be noticeable.


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to