summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-09-21 14:06:05 +0800
committerruki <[email protected]>2019-09-21 14:06:05 +0800
commit5b88b634eab688584c3731ea3be376f10e5beb57 (patch)
treebd1980c55862a1531b2a69a1e70ff30bf097e9e9
parent8087d1444858635b8f801e8cf13eedc96cf53f83 (diff)
improve xmakefile
-rw-r--r--xmake/plugins/project/make/xmakefile.lua47
1 files changed, 39 insertions, 8 deletions
diff --git a/xmake/plugins/project/make/xmakefile.lua b/xmake/plugins/project/make/xmakefile.lua
index 596c22ac6..283e7eaa2 100644
--- a/xmake/plugins/project/make/xmakefile.lua
+++ b/xmake/plugins/project/make/xmakefile.lua
@@ -26,56 +26,76 @@ function _make_build(makefile)
makefile:print(".PHONY: build")
makefile:print("")
makefile:print("build: ")
- makefile:print("\t@xmake --build %${TARGET}")
+ makefile:print("\t@xmake --build %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make rebuild
function _make_rebuild(makefile)
makefile:print("rebuild: ")
- makefile:print("\t@xmake --rebuild %${TARGET}")
+ makefile:print("\t@xmake --rebuild %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make install
function _make_install(makefile)
makefile:print("install: ")
- makefile:print("\t@xmake install %${TARGET}")
+ makefile:print("\t@xmake install %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make uninstall
function _make_uninstall(makefile)
makefile:print("uninstall: ")
- makefile:print("\t@xmake uninstall %${TARGET}")
+ makefile:print("\t@xmake uninstall %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make package
function _make_package(makefile)
makefile:print("package: ")
- makefile:print("\t@xmake package %${TARGET}")
+ makefile:print("\t@xmake package %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make clean
function _make_clean(makefile)
makefile:print("clean: ")
- makefile:print("\t@xmake clean %${TARGET}")
+ makefile:print("\t@xmake clean %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make run
function _make_run(makefile)
makefile:print("run: ")
- makefile:print("\t@xmake run %${TARGET}")
+ makefile:print("\t@xmake run %$(VERBOSE) %$(TARGET)")
makefile:print("")
end
-- make debug
function _make_debug(makefile)
makefile:print("debug: ")
- makefile:print("\t@xmake run -d %${TARGET}")
+ makefile:print("\t@xmake run -d %$(VERBOSE) %$(TARGET)")
+ makefile:print("")
+end
+
+-- make config
+function _make_config(makefile)
+ makefile:print("ifneq (%$(PLAT),)")
+ makefile:print("ifneq (%$(ARCH),)")
+ makefile:print("ifneq (%$(MODE),)")
+ makefile:print("CONFIG=xmake config -c %$(VERBOSE) -p %$(PLAT) -a %$(ARCH) -m %$(MODE) %$(TARGET)")
+ makefile:print("else")
+ makefile:print("CONFIG=xmake config -c %$(VERBOSE) -p %$(PLAT) -a %$(ARCH) %$(TARGET)")
+ makefile:print("endif")
+ makefile:print("else")
+ makefile:print("CONFIG=xmake config -c %$(VERBOSE) -p %$(PLAT) %$(TARGET)")
+ makefile:print("endif")
+ makefile:print("else")
+ makefile:print("CONFIG=xmake config -c %$(VERBOSE) %$(TARGET)")
+ makefile:print("endif")
+ makefile:print("config: ")
+ makefile:print("\t@%$(CONFIG)")
makefile:print("")
end
@@ -88,6 +108,14 @@ function make(outputdir)
-- open the makefile
local makefile = io.open(path.join(outputdir, "makefile"), "w")
+ -- verbose?
+ makefile:print("ifeq (%$(V),1)")
+ makefile:print("VERBOSE=-v")
+ makefile:print("else")
+ makefile:print("VERBOSE=")
+ makefile:print("endif")
+ makefile:print("")
+
-- make build
_make_build(makefile)
@@ -111,6 +139,9 @@ function make(outputdir)
-- make debug
_make_debug(makefile)
+
+ -- make config
+ _make_config(makefile)
-- close the makefile
makefile:close()