How to run make file from any directory?
up vote
1
down vote
favorite
In order to run make file, I am supposed to go to the make file's directory and from there only I can run the make file. How can I do the same even if i am in any directory?
make makefile
add a comment |
up vote
1
down vote
favorite
In order to run make file, I am supposed to go to the make file's directory and from there only I can run the make file. How can I do the same even if i am in any directory?
make makefile
1
Whichmake
? Borland'smake
? GNUmake
? Microsoft'snmake
? One of the umpteen shareware implementations ofmake
that have floated around over the years? And on what platform? The answer is different depending from the specifics.RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.
– JdeBP
Dec 23 '11 at 13:43
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In order to run make file, I am supposed to go to the make file's directory and from there only I can run the make file. How can I do the same even if i am in any directory?
make makefile
In order to run make file, I am supposed to go to the make file's directory and from there only I can run the make file. How can I do the same even if i am in any directory?
make makefile
make makefile
asked Dec 22 '11 at 9:26
Dinesh
144118
144118
1
Whichmake
? Borland'smake
? GNUmake
? Microsoft'snmake
? One of the umpteen shareware implementations ofmake
that have floated around over the years? And on what platform? The answer is different depending from the specifics.RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.
– JdeBP
Dec 23 '11 at 13:43
add a comment |
1
Whichmake
? Borland'smake
? GNUmake
? Microsoft'snmake
? One of the umpteen shareware implementations ofmake
that have floated around over the years? And on what platform? The answer is different depending from the specifics.RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.
– JdeBP
Dec 23 '11 at 13:43
1
1
Which
make
? Borland's make
? GNU make
? Microsoft's nmake
? One of the umpteen shareware implementations of make
that have floated around over the years? And on what platform? The answer is different depending from the specifics. RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.– JdeBP
Dec 23 '11 at 13:43
Which
make
? Borland's make
? GNU make
? Microsoft's nmake
? One of the umpteen shareware implementations of make
that have floated around over the years? And on what platform? The answer is different depending from the specifics. RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.– JdeBP
Dec 23 '11 at 13:43
add a comment |
3 Answers
3
active
oldest
votes
up vote
6
down vote
accepted
(cd /other/dir && make)
will not change your shell's current directory, but will run make
with the indicated working directory.
The &&
will ensure that make
doesn't run if there's an error in the cd
part of the command (e.g., the directory doesn't exist, or you don't have access to it).
6
Looks like there's a-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774
– Noyo
Oct 24 '13 at 13:34
add a comment |
up vote
3
down vote
make -C dir
Change to directory dir
before reading the pointed makefile.
add a comment |
up vote
0
down vote
Use cd ./dir && make && pwd
inside Makefile .
Example of sample Makefile :
BUILD_DIR = $(shell pwd)
deploy::
cd ./dist/local && make && pwd && npm publish && cd .. && cd .. && pwd
clean::
npm cache clean --force
New contributor
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
(cd /other/dir && make)
will not change your shell's current directory, but will run make
with the indicated working directory.
The &&
will ensure that make
doesn't run if there's an error in the cd
part of the command (e.g., the directory doesn't exist, or you don't have access to it).
6
Looks like there's a-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774
– Noyo
Oct 24 '13 at 13:34
add a comment |
up vote
6
down vote
accepted
(cd /other/dir && make)
will not change your shell's current directory, but will run make
with the indicated working directory.
The &&
will ensure that make
doesn't run if there's an error in the cd
part of the command (e.g., the directory doesn't exist, or you don't have access to it).
6
Looks like there's a-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774
– Noyo
Oct 24 '13 at 13:34
add a comment |
up vote
6
down vote
accepted
up vote
6
down vote
accepted
(cd /other/dir && make)
will not change your shell's current directory, but will run make
with the indicated working directory.
The &&
will ensure that make
doesn't run if there's an error in the cd
part of the command (e.g., the directory doesn't exist, or you don't have access to it).
(cd /other/dir && make)
will not change your shell's current directory, but will run make
with the indicated working directory.
The &&
will ensure that make
doesn't run if there's an error in the cd
part of the command (e.g., the directory doesn't exist, or you don't have access to it).
edited Oct 24 '13 at 14:06
Scott
15.4k113789
15.4k113789
answered Dec 22 '11 at 9:34
RedGrittyBrick
66.3k12104159
66.3k12104159
6
Looks like there's a-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774
– Noyo
Oct 24 '13 at 13:34
add a comment |
6
Looks like there's a-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774
– Noyo
Oct 24 '13 at 13:34
6
6
Looks like there's a
-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774– Noyo
Oct 24 '13 at 13:34
Looks like there's a
-C
option to make for most Unixes these days. Details and some more complete answers here: stackoverflow.com/q/453447/357774– Noyo
Oct 24 '13 at 13:34
add a comment |
up vote
3
down vote
make -C dir
Change to directory dir
before reading the pointed makefile.
add a comment |
up vote
3
down vote
make -C dir
Change to directory dir
before reading the pointed makefile.
add a comment |
up vote
3
down vote
up vote
3
down vote
make -C dir
Change to directory dir
before reading the pointed makefile.
make -C dir
Change to directory dir
before reading the pointed makefile.
edited Oct 12 '17 at 7:53
Kamil Maciorowski
22.3k155072
22.3k155072
answered Oct 12 '17 at 7:26
Jonathan
1311
1311
add a comment |
add a comment |
up vote
0
down vote
Use cd ./dir && make && pwd
inside Makefile .
Example of sample Makefile :
BUILD_DIR = $(shell pwd)
deploy::
cd ./dist/local && make && pwd && npm publish && cd .. && cd .. && pwd
clean::
npm cache clean --force
New contributor
add a comment |
up vote
0
down vote
Use cd ./dir && make && pwd
inside Makefile .
Example of sample Makefile :
BUILD_DIR = $(shell pwd)
deploy::
cd ./dist/local && make && pwd && npm publish && cd .. && cd .. && pwd
clean::
npm cache clean --force
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
Use cd ./dir && make && pwd
inside Makefile .
Example of sample Makefile :
BUILD_DIR = $(shell pwd)
deploy::
cd ./dist/local && make && pwd && npm publish && cd .. && cd .. && pwd
clean::
npm cache clean --force
New contributor
Use cd ./dir && make && pwd
inside Makefile .
Example of sample Makefile :
BUILD_DIR = $(shell pwd)
deploy::
cd ./dist/local && make && pwd && npm publish && cd .. && cd .. && pwd
clean::
npm cache clean --force
New contributor
edited Nov 13 at 12:05
Twisty Impersonator
16.5k126090
16.5k126090
New contributor
answered Nov 13 at 11:35
Mahesh Wable
1
1
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f370575%2fhow-to-run-make-file-from-any-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Which
make
? Borland'smake
? GNUmake
? Microsoft'snmake
? One of the umpteen shareware implementations ofmake
that have floated around over the years? And on what platform? The answer is different depending from the specifics.RedGrittyBrick
is presuming that you have a POSIX-conformant shell and filesystem, for example.– JdeBP
Dec 23 '11 at 13:43