help-make
[Top][All Lists]
Advanced

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

Re: Help with make rule


From: Oleksandr Gavenko
Subject: Re: Help with make rule
Date: Mon, 24 Jan 2011 12:08:14 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

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'.

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



reply via email to

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