Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

On Thu, May 16, 2013 at 01:22:10AM +0200, Mat M wrote:
Hello

I have a GNU make question, actually:

How this should be read ?
$(dir $(call gb_AutoInstallLibs_get_target,%)).dir :
      $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

We use rules to automatically create directory hierarchies for file
targets in gbuild. This is the rule for creating the top-level directory
of the AutoInstallLibs class in $(WORKDIR). There is a line like

$(call gb_AutoInstallLibs_get_target,$(1)) :| $(dir $(call gb_AutoInstallLibs_get_target,$(1))).dir

elsewhere in the makefile, that creates the (order-only) dependency.

Note that $(dir $(call gb_AutoInstallLibs_get_target,%)).dir expands to
$(WORKDIR)/AutoInstallLibs/.dir , so this is not a pattern rule. If
there were any hierarchy needed in the directory, the rule would be
accompanied by

$(dir $(call gb_AutoInstallLibs_get_target,%))%/.dir :
        $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

, that expands to $(WORKDIR)/AutoInstallLibs/%/.dir . The recipe checks
if the directory (without the .dir suffix) exists and creates it if it
does not.

Last thing, the .dir suffix is a workaround needed for make 3.81, that
does not handle directory rules. Otherwise it could just be

$(dir $(call gb_AutoInstallLibs_get_target,%)) :
    mkdir -p $@

D.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.