Creating directories by dependency now a little easier

https://bugzilla.mozilla.org/show_bug.cgi?id=750303

Bug 750303 has landed and will help make dependent directory creation for {+/-nop} builds a bit easier.

Current handling involves generating dependencies with the mkdir_deps library function then listing them as explicit target pre-requisites within a makefile:

    lib-preqs = $(call mkdir_deps,install_dir)
    my-lib-targets: $(lib-preqs)

Bug 750303 has added a new set of GENERATED_DIRS_* variables to handle dep/directory creation. Variables are assigned a simple list of directories that will be automagically created when a target is processed.

    GENERATED_DIRS_export := foo
    GENERATED_DIRS_libs := bar tans
    GENERATED_DIRS_tools := fans

WRT the ‘_tools’ variable, a fans directory will be created when ‘make tools’ is invoked and the fans/ directory does not already exist.

Using a variable assignment the -preqs example above can now be written as:

    GENERATED_DIRS_libs := install_here
    include $(topsrcdir)/config/rules.mk

    libs:: tests/input.sh
    $(CP) $< install_here

One item of note: GENERATED_DIRS_* will also be a stepping stone for converting makefiles into moz.build synatx. When directory creation logic has been isolated within a fixed set of variables they can easily be identified and extracted in bulk for conversion.

Advertisements
This entry was posted in makefiles. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s