shell - pushd not working in makefile -


i have following rule in makefile:

ninja:     git clone git://github.com/martine/ninja.git     pushd ninja     pwd     git checkout release     ./configure.py --bootstrap     popd 

the idea download , build ninja automatically project dependency. notice pwd command there make sure directory pushed. here's output generates:

git clone git://github.com/martine/ninja.git cloning 'ninja'... remote: counting objects: 8646, done. remote: compressing objects: 100% (4/4), done. remote: total 8646 (delta 0), reused 0 (delta 0), pack-reused 8642 receiving objects: 100% (8646/8646), 1.88 mib | 427.00 kib/s, done. resolving deltas: 100% (6114/6114), done. checking connectivity... done. pushd ninja ~/desktop/core/ninja ~/desktop/core pwd /users/fratelli/desktop/core git checkout release error: pathspec 'release' did not match file(s) known git. make: *** [ninja] error 1 

as can see directory pushed stack, pwd not return correct directory. that's why checkout fails afterwards. ideas how fix this?

each line in makefile target recipe run in own shell session. doesn't affect recipes operate in directory need default. when don't , need use cd or pushd need write commands on same line or tell make lines continued.

see splitting recipe lines more details , examples.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -