makefile - Clang++ -c outputs files to the wrong directory -


i have makefile target contains these steps:

... cd $(graphics_build_dir) clang++ -c -i$(sfml_headers) $(graphics_dir)/*.cpp cd $(base_dir) ... 

for reason, clang outputs build files base_dir, not graphics_build_dir. compiles fine, , when execute 1 line @ time manually, works fine, , *.o files outputted in correct directory.

why doesn't make put these files in correct directory, , how can force to?

i'm using clang3.1 , current version of gnumake on ubuntu linux kernel 3.2.0-26.

the trouble in make rule, each command executes in own subshell; nothing remembered 1 line next. first command starts in $(base_dir), moves $(graphics_build_dir), , dies. second command starts in $(base_dir) , runs clang there.

try this:

... cd $(graphics_build_dir) ; clang++ -c -i$(sfml_headers) $(graphics_dir)/*.cpp ... 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -