Dependency can be defined more than one place. It's very interesting.

        Syntax : Take you attention that there is NO command in rule.
        <target> : <dep>
       
At abve case, <dep> is ADDED to <target>'s existing dependency (NOT "replace"!!)
But, if there is COMMAND at above rule, old COMMAND is "REPLACED" (NOTE that, dependency is still ADDED).
See below examples to help understanding.
   
    < Makefile >
    all: a
        touch all0
    a
        touch a
    all: b
    b
        touch b
   
    > make
        touch a
        touch b
        touch all0
       
    ----------------------
       
    < Makefile >
    all: a
    a
        touch a
    all: b
        touch all1
    b
        touch b
   
    > make
        touch b
        touch a
        touch all1
       
    ----------------------
       
    < Makefile >
    all: a
        touch all0
    a
        touch a
    all: b
        touch all1
    b
        touch b
   
    > make
        touch b
        touch a
        touch all1
       
    # Same with above
    # That is, older command for target is replaced with newer one.

Remind! :
'make' can tell difference between normal line and command only by using 'tab'.

It's same in GNU Automake.
Here two simple 'Makefile.am' - A, B.

[A]
...
if COND_X
[spaces]VARX=xxx
endif
...

[B]
...
if COND_X
[tab]VARX=xxx
endif
...

Only difference is leading spaces [A] and leading tab [B].
But, in case of [B], make regard 'VARX=xxx' as command.
So, 'Makefile.in' generated by 'automake' looks like follows.

[A]
...
(usually, at the head of Makefile.in)
VARX=xxx
...
(start rules)
all: config.h ...

[B]
...
(usually, at the end of Makefile.in)
.PHONY
[tab]VARX=xxx
...

So, in case [B], 'VARX' cannot be used as a variable at the 'rule' part!
The point is, "'Tab' means 'Command' in 'Make'!".
Keep this in mind!

[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]
 

Strange!

'-p' option at gnumake is for making db. But, according to my experience, '$(shell xxxx)' seems not to described in the db generated by '-p' option.
I didn't check this in the gnumake document. This should be checked later!!!

+ Recent posts