wiki:Building/Architecture/Idiom/Directories

Version 2 (modified by igloo, 5 years ago) (diff)

--

Idiom: Directories

In order to create directories, we use "order-only" make dependencies, e.g.

build/foo.o : foo.c foo.h | $$(dir $$@)/.
    gcc $< -o $@

Dependencies after the | are order-only, i.e. we only require that the directory exists, not that build/foo.o is newer than it. The doubled-dollars are because this needs to happen during the second-expansion phase, as $@ is not available during the first-expansion.