From 6669794434cb9f472aafce126162b9b81389df5f Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 3 May 2024 12:24:13 +0200 Subject: Rename to ymake --- Makefile | 4 +-- XMakefile | 7 ----- YMakefile | 8 +++++ builder.cpp | 14 ++++----- debian/README.Debian | 6 ++-- debian/changelog | 2 +- debian/control | 10 +++---- main.cpp | 4 +-- xmake.cpp | 83 ---------------------------------------------------- xmake.h | 4 --- ymake.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ ymake.h | 4 +++ 12 files changed, 115 insertions(+), 114 deletions(-) delete mode 100644 XMakefile create mode 100644 YMakefile delete mode 100644 xmake.cpp delete mode 100644 xmake.h create mode 100644 ymake.cpp create mode 100644 ymake.h diff --git a/Makefile b/Makefile index 5ca10a0..c24af4d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -PROJECTNAME=xmake +PROJECTNAME=ymake -SRC=main.cpp xmake.cpp builder.cpp +SRC=main.cpp ymake.cpp builder.cpp OBJ=$(SRC:.cpp=.o) diff --git a/XMakefile b/XMakefile deleted file mode 100644 index ac3a34e..0000000 --- a/XMakefile +++ /dev/null @@ -1,7 +0,0 @@ - - - xmake - xmake.cpp - main.cpp - - diff --git a/YMakefile b/YMakefile new file mode 100644 index 0000000..152ccc6 --- /dev/null +++ b/YMakefile @@ -0,0 +1,8 @@ + + + ymake + builder.cpp + main.cpp + ymake.cpp + + diff --git a/builder.cpp b/builder.cpp index 0493bb3..ee9c16b 100644 --- a/builder.cpp +++ b/builder.cpp @@ -29,12 +29,12 @@ using namespace std::string_literals; namespace { fs::path get_target(const pt::ptree& ptree) { - return ptree.get("xmake.build.name"); + return ptree.get("ymake.build.name"); } std::vector get_sources(const pt::ptree& ptree) { std::vector sources; - for (const pt::ptree::value_type &v: ptree.get_child("xmake.build")) { + for (const pt::ptree::value_type &v: ptree.get_child("ymake.build")) { if (v.first == "source") sources.push_back(v.second.data()); } @@ -120,7 +120,8 @@ namespace { fs::path p_obj{p}; p_obj.replace_extension("o"); std::vector deps {make_depfile_from(p)}; - fs::remove(depfile_name_from(p)); + // keep .d files for now to speed dependencies detection on following runs + //fs::remove(depfile_name_from(p)); dependencies.emplace(p_obj, deps); } return dependencies; @@ -277,10 +278,9 @@ void Builder::clean() { if (fs::exists(i)) { commands.push_back(fmt::format("rm -f {}", i.string())); } - fs::path dep{i}; - dep.replace_extension("d"); - if (fs::exists(dep)) { - commands.push_back(fmt::format("rm -f {}", dep.string())); + fs::path depfile{depfile_name_from(i)}; + if (fs::exists(depfile)) { + commands.push_back(fmt::format("rm -f {}", depfile.string())); } } diff --git a/debian/README.Debian b/debian/README.Debian index 4da4a5b..cc7a1c9 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,7 +1,7 @@ -xmake for Debian +ymake for Debian ================ -This package is the Debian version of xmake. +This package is the Debian version of ymake. It is a build system with XML based config files. @@ -9,7 +9,7 @@ It is a build system with XML based config files. Usage ----- -Run "xmake" like "make" to build programs with an XMakefile. +Run "ymake" like "make" to build programs with an YMakefile. Contact diff --git a/debian/changelog b/debian/changelog index d94dedf..1af324c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -xmake (1.0) unstable; urgency=medium +ymake (1.0) unstable; urgency=medium * Initial release diff --git a/debian/control b/debian/control index c27819e..a54f393 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ -Source: xmake +Source: ymake Section: devel Priority: optional Maintainer: Roland Reichwein Build-Depends: debhelper (>= 12), libboost-all-dev | libboost1.71-all-dev, clang | g++-9, llvm | g++-9, lld | g++-9, pkg-config, libfmt-dev, googletest, gcovr, libreichwein-dev Standards-Version: 4.5.0 -Homepage: http://www.reichwein.it/xmake/ +Homepage: http://www.reichwein.it/ymake/ -Package: xmake +Package: ymake Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Homepage: http://www.reichwein.it/xmake/ +Homepage: http://www.reichwein.it/ymake/ Description: Buildsystem - XMake is a buildsystem with automatically resolved dependencies. + YMake is a buildsystem with automatically resolved dependencies. diff --git a/main.cpp b/main.cpp index 964a3bb..d31b1fb 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,7 @@ -#include "xmake.h" +#include "ymake.h" int main(int argc, char* argv[]) { - return xmake(argc, argv); + return ymake(argc, argv); } diff --git a/xmake.cpp b/xmake.cpp deleted file mode 100644 index 5a12bb4..0000000 --- a/xmake.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "xmake.h" - -#include "builder.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -namespace fs = std::filesystem; -namespace bp = boost::process; -namespace pt = boost::property_tree; -using namespace std::string_literals; - -namespace { - const fs::path XMakefile{"XMakefile"}; - - void usage() - { - std::cout << "Usage: xmake " << std::endl; - } - -} - -int xmake(int argc, char* argv[]) -{ - try { - pt::ptree ptree; - pt::read_xml(XMakefile, ptree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace); - - std::string action{"default"}; - - if (argc == 1) { // default action - } else if (argc == 2) { - action = argv[1]; - } else { - std::cerr << "Invalid arguments." << std::endl; - usage; - exit(1); - } - - Builder builder(ptree); - if (action == "default"s || action == "build") { // build - builder.build(); - } else if (action == "clean") { - builder.clean(); - } else if (action == "install") { - throw std::runtime_error("unimplemented"); - } else if (action == "rebuild") { - throw std::runtime_error("unimplemented"); - } else if (action == "run") { - throw std::runtime_error("unimplemented"); - } else { - std::cerr << "Invalid action: " << action << std::endl; - usage; - exit(1); - } - - } catch (const std::exception& ex) { - std::cerr << "xmake: " << ex.what() << std::endl; - return 1; - } - - return 0; -} - diff --git a/xmake.h b/xmake.h deleted file mode 100644 index 6c402cf..0000000 --- a/xmake.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -int xmake(int argc, char* argv[]); - diff --git a/ymake.cpp b/ymake.cpp new file mode 100644 index 0000000..93a813e --- /dev/null +++ b/ymake.cpp @@ -0,0 +1,83 @@ +#include "ymake.h" + +#include "builder.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +namespace fs = std::filesystem; +namespace bp = boost::process; +namespace pt = boost::property_tree; +using namespace std::string_literals; + +namespace { + const fs::path YMakefile{"YMakefile"}; + + void usage() + { + std::cout << "Usage: ymake " << std::endl; + } + +} + +int ymake(int argc, char* argv[]) +{ + try { + pt::ptree ptree; + pt::read_xml(YMakefile, ptree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace); + + std::string action{"default"}; + + if (argc == 1) { // default action + } else if (argc == 2) { + action = argv[1]; + } else { + std::cerr << "Invalid arguments." << std::endl; + usage; + exit(1); + } + + Builder builder(ptree); + if (action == "default"s || action == "build") { // build + builder.build(); + } else if (action == "clean") { + builder.clean(); + } else if (action == "install") { + throw std::runtime_error("unimplemented"); + } else if (action == "rebuild") { + throw std::runtime_error("unimplemented"); + } else if (action == "run") { + throw std::runtime_error("unimplemented"); + } else { + std::cerr << "Invalid action: " << action << std::endl; + usage; + exit(1); + } + + } catch (const std::exception& ex) { + std::cerr << "ymake: " << ex.what() << std::endl; + return 1; + } + + return 0; +} + diff --git a/ymake.h b/ymake.h new file mode 100644 index 0000000..b0f4741 --- /dev/null +++ b/ymake.h @@ -0,0 +1,4 @@ +#pragma once + +int ymake(int argc, char* argv[]); + -- cgit v1.2.3