linux - different - run make from another directory
In Unix, can I run 'make' in a directory without cd'ing to that directory first? (4)
In Unix, can I run 'make' in a directory without cd'ing to that directory first?
make -C /path/to/dir
Also you may use:
make --directory /path/to/dir
If the reason you don't want to cd to a directory is because you need to stay in the current directory for a later task, you can use pushd and popd:
pushd ProjectDir ; make ; popd
That goes into the ProjectDir, runs make, and goes back to where you were.
all: gcc -Wall -Wpedantic -std=gnu99 -g src/test.c -o build/test run: ./build/test