-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
Make replacement #972
Comments
You need only call target("a")
set_kind("binary")
add_files("src/*.c")
after_build(function (target)
os.execv("create-msi.exe", {target:targetfile()})
-- or
-- os.exec("create-msi.exe %s", target:targetfile())
end)
You can also define a dependent phony target to do it. target("a")
set_kind("binary")
add_files("src/*.c")
target("msi")
set_kind("phony")
add_deps("a") -- add dependences
on_build(function (target)
os.execv("create-msi.exe", {target:dep("a"):targetfile()})
end) Or you can also define a custom rule to do it. -- define a custom msi rule
rule("msi")
after_build(function (target)
os.execv("create-msi.exe", {target:targetfile()})
end)
target("a")
set_kind("binary")
add_files("src/*.c")
add_rules("msi") --- apply msi rule to this target And we can also add dependencies for multiple rules through rule("x")
-- ...
rule("y")
add_deps("x")
-- ..
target("a")
add_rules("y") -- it will apply rules: x and y
xmake does not rely on make, but it can also generate makefiles. xmake project -k makefile |
What is obviously missing is the check that a.msi is up-to-date and also if this get more complicated. Basically a Makefile is a DAG where edges should be ordered according to the dependencies. |
You can add a check through os.mtime/io.load/io.save ... xmake/xmake/rules/lex_yacc/lex/xmake.lua Line 83 in d9b466e
|
Yes, I could do this. Lua is a programming language and allows everything. But this is a feature request for something that is easily done in make, but not in xmake. |
I added after_build(function (target)
import("core.project.depend")
depend.on_changed(function ()
os.execv("create-msi.exe", {target:targetfile()})
end, {files = target:targetfile()})
end) |
Is your feature request related to a problem? Please describe.
xmake is a good replacement for CMake, but it is not a good replacement for make. As far as I understand it lacks the simple file dependencies like
Describe the solution you'd like
Top level rule for a file with dependencies on other files, tasks, targets, e.g.:
add_file_target("a.msi", ["a.exe"], function() {
execute_program("create-msi.exe", ["a.exe"]);
})
Describe alternatives you've considered
Using make
Additional context
The text was updated successfully, but these errors were encountered: