*/
static bool propagate_vars = false;
+
+/**
+ * Whether to print that we changed working directory (to be nice with emacs)
+ */
+static bool print_change_working_dir = false;
+
#ifndef WINDOWS
static volatile sig_atomic_t got_SIGCHLD = 0;
*/
static void init_prefix_dir()
{
+ std::string old_prefix_dir = prefix_dir;
for (;;)
{
struct stat s;
if (stat((prefix_dir + "/Remakefile").c_str(), &s) == 0)
{
- chdir(prefix_dir.c_str());
- return;
+ if (0 == chdir(prefix_dir.c_str()))
+ {
+ if (old_prefix_dir != prefix_dir)
+ {
+ std::cout << "remake: Entering directory `"
+ << prefix_dir << "'"
+ << std::endl;
+ print_change_working_dir = true;
+ }
+ return;
+ }
+ else
+ {
+ std::cerr << "Cannot change working directory to '" << prefix_dir << "'";
+ exit(EXIT_FAILURE);
+ }
}
size_t pos = prefix_dir.find_last_of('/');
if (pos == std::string::npos)
free(socket_name);
#endif
save_dependencies();
+ if (print_change_working_dir)
+ std::cout << "remake: Leaving directory `" << prefix_dir
+ << "'" <<std::endl;
exit(build_failure ? EXIT_FAILURE : EXIT_SUCCESS);
}