Skip to content

Fix recursive BUILD_DIR in test makefile #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions server/src/printers/RelativeMakefilePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,12 @@ void RelativeMakefilePrinter::declareShellVariable(const std::string& variableNa

std::string RelativeMakefilePrinter::getProjectStructureRelativeTo(fs::path path) const {
DefaultMakefilePrinter printer;
printer.declareVariable("export PROJECT_DIR_RELATIVE_TO_MAKEFILE",
fs::relative(projectPath, path));
printer.declareVariable("export PROJECT_DIR_RELATIVE_TO_MAKEFILE", fs::relative(projectPath, path));
// magic spell from https://stackoverflow.com/questions/18136918/how-to-get-current-relative-directory-of-your-makefile
printer.declareVariable("export MAKEFILE_DIR", "$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))");
printer.declareVariable("export PROJECT_DIR",
StringUtils::stringFormat("%s/%s", "$(MAKEFILE_DIR)", "$(PROJECT_DIR_RELATIVE_TO_MAKEFILE)"));
printer.declareVariable("export PROJECT_DIR", "$(MAKEFILE_DIR)/$(PROJECT_DIR_RELATIVE_TO_MAKEFILE)");
printer.declareVariable("export BUILD_RELATIVE", buildDirectoryRelative);
printer.declareVariable("export BUILD_DIR", StringUtils::stringFormat("%s/%s",
getRelativePath(projectPath),
getRelativePath(buildDirectoryRelative)));
printer.declareVariable("export BUILD_DIR", "$(PROJECT_DIR)/$(BUILD_RELATIVE)");
return printer.ss.str();
}

Expand Down