change of directory in makefile

hi,

i would like to execute
1
2
3
4
5
6
7
8

.....

BIN=/home/usr/projet/bin
all:prog
     mv -f $(EXEC) $(BIN)
     cd $(BIN)
prog: .....

the command cd can't change the directory
why not?? and what is the solution???

yet i execute
make && cd bin
but i would like to do that in my makefile

thinks

What do you want it to do once it gets there? Each command is executed in a subshell, so the subshell changes directory, but the end result is that the next command is still in the current directory.

With GNU make, you can do something like:

1
2
3
BIN=/bin
foo:
    $(shell cd $(BIN); ls)


to execute a collection of commands in one subshell.
Topic archived. No new replies allowed.