1. 0

  2. 1

    Is there a good guide out there somewhere for using xmake as a replacement for make for projects that are not necessarily C, C++, and so on? I use make to do some automation so that I don’t have to remember complex docker commands and to automate some diagrams and financial reports. I’d love to use something that is not make to do this but make is just always… there.

    1. 1

      You can see the partial english document and api manual in http://xmake.io/#/home

      1. 1

        I looked through the documentation and couldn’t find what I was looking for, thus inspiring my post. I want to turn something like this into xmake:

        all: report.html
        %.html: %.md
            md2html $< $@
        %.md: %.ledger
            echo "# Report \n\n \`\`\`" > $@
            $(LEDGER_BIN) -f $< bal >> $@
            echo "\`\`\`" >> $@
        1. 1

          In current version you need to customize the after_build to implement it:

              -- or after_package/after_install
              after_build(function (target)
                  for _, sourcefile in ipairs(os.files("$(projectdir)/src/*.ledger")) do
                        local mdfile = sourcefile .. ".md"
                        io.writefile(mdfile, "xxxxxx")
                        os.exec("md2html %s %s", mdfile, mdfile .. ".html")

          If you want to extend add_files to implement more flexible custom build rules, I’m currently developing and will support it. in the next version You can see https://github.com/tboox/xmake/issues/149

          1. 1

            You can update the newest version in master branch and use the following code to custom building rule:

                set_extensions(".md", ".markdown")
                on_build(function (target, sourcefile)
                      os.exec("md2html %s %s", sourcefile, sourcefile .. ".html")
                on_build(function (target, sourcefile)
                    -- ...
                    rule.build("markdown", target, sourcefile)
                add_rules("markdown", "ledger")
                add_files("./src/*. md")
                add_files("./src/*. ledger")