On 20.01.2011 21:37, Paul Smith wrote:
I typically just force the directory to be created, with something like:

         __dummy := $(shell mkdir -p $(objdir))

This will be run before any rules.
I also pactice such pattern (look at BUILD_DIRS):

$(APP_DLL): $(O_FILES) $(RES_FILE) $(DEF_FILE) | $(DIST_DIR)
$(LD) $(LDFLAGS) /DLL /OUT:$@ /DEF:$(DEF_FILE) $(O_FILES) $(RES_FILE) $(LIBS)

$(C_O_FILES): $(BUILD_DIR)/%.$(O_EXT): %.c $(BUILD_SCRIPTS) | $(BUILD_DIRS)
        $(CC) $(CPPFLAGS) $(CFLAGS) /MT /c /Fo$@ $<

$(BUILD_DIRS):
        mkdir -p $@

Another practice I use:

.PHONY: dist
dist: init my.exe

.PHONY: init
init:
        mkdir $(BUILD_DIR) $(DIST_DIR)

but this method have disadvantage: you can not
invoke 'make my.exe' directly as 'init' does not
present in dependency of 'my.exe'.

If it present as dependency in 'my.exe'
'my.exe' all time was rebuilt as 'init' target is '.PHONY'.

You must directly invoke 'make dist'.

--
С уважением, Александр Гавенко.

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to