help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to handle build directory prerequisites


From: Paul D. Smith
Subject: Re: how to handle build directory prerequisites
Date: Tue, 19 Nov 2002 20:10:04 -0500

Creating directories using prerequisites is a bad idea, in a number of
ways.

The best way to do it is by adding this to your makefile:

  BUILD_DIR = build

  __dummy := $(shell [ -d $(BUILD_DIR) ] || mkdir $(BUILD_DIR))

  all: $(BUILD_DIR)/foo $(BUILD_DIR)/bar

  $(BUILD_DIR)/foo:
                echo "hello" > $(BUILD_DIR)/foo

  $(BUILD_DIR)/bar:
                echo "hi there" > $(BUILD_DIR)/bar

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]