c++ - How to export directly in a Makefile? -
i want export directly in makefile did rule 1 :
export: export ld_library_path=./smthing/here and call rule in $(name)
$(name): $(objs) $(cxx) -o $(name) $(objs) $(cxxflags) $(ldflags) $(export) $(objs) simple rule convert .cpp .o.
$(cxxflags) compiling flags : -wall -werror -wextra
and on $(ldflags) got point..
the problem here export rule done didn't exported expected. why ? can me ?
i got if don't export hand in terminal :
./cutom_prog: error while loading shared libraries: custom_lib.so: cannot open shared object file: no such file or directory
if want handle exporting makefile, try:
$(name): $(objs) @export my_env_var=my_value; \ $(cxx) -o $(name) $(objs) $(cxxflags) $(ldflags) exporting work if called in same subshell command itself.
however, solution not going work ld_library_path, because intention update parent process make, not possible.
the workaround create wrapper script would:
- build application calling
make - set ld_library_path
- launch application
Comments
Post a Comment