2013-04-17 21:41:41 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
# for path inspection:
|
2013-04-18 01:46:47 +02:00
|
|
|
import sys
|
2013-04-17 21:41:41 +02:00
|
|
|
import os
|
2013-04-18 01:46:47 +02:00
|
|
|
import inspect
|
2013-04-17 21:41:41 +02:00
|
|
|
import fnmatch
|
2013-04-19 22:06:05 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.path.append(os.path.dirname(__file__) + "/corePython/" )
|
2013-04-17 21:41:41 +02:00
|
|
|
|
2013-04-19 22:06:05 +02:00
|
|
|
import debug
|
|
|
|
import environement
|
2013-04-17 21:41:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
"""
|
2013-04-18 01:46:47 +02:00
|
|
|
Display the help of this makefile
|
2013-04-17 21:41:41 +02:00
|
|
|
"""
|
2013-04-19 22:06:05 +02:00
|
|
|
def usage():
|
2013-04-18 01:46:47 +02:00
|
|
|
print "usage:"
|
2013-04-19 22:06:05 +02:00
|
|
|
print " " + sys.argv[0] + " [options] [cible/properties] ..."
|
2013-04-18 01:46:47 +02:00
|
|
|
print " [help] display this help"
|
2013-04-19 22:06:05 +02:00
|
|
|
print " [option] : keep the last set"
|
|
|
|
print " [-h/--help] Display this help and break"
|
|
|
|
print " [-v?/--verbose=?] Display makefile debug level (verbose) default =2"
|
|
|
|
print " [-c/--color] Display makefile output in color"
|
|
|
|
print " [-f/--force] Force the rebuild without checking the dependency"
|
|
|
|
print " [properties] : keep in the sequency of the cible"
|
|
|
|
print " [-p=.../--platform=...] (Android/Linux/MacOs/Windows) Select a platform (by default the platform is the computer that compile this"
|
|
|
|
print " [-t/--tool] (clang/gcc) Compile with clang or Gcc mode (by default gcc will be used)"
|
|
|
|
print " [-m=.../--mode=...] (debug/release) Compile in release or debug mode (default release)"
|
|
|
|
print " [cible] : generate in order set"
|
|
|
|
print " [dump] Dump all the module dependency and properties"
|
|
|
|
print " [all] Build all (only for the current selected board) (bynary and packages)"
|
|
|
|
print " [clean] Clean all (same as previous)"
|
|
|
|
print " ... You can add 'module name' with at end : -clean to clean only this element"
|
2013-04-18 01:46:47 +02:00
|
|
|
print " ex: " + sys.argv[0] + " all board=Android all board=Windows all help"
|
|
|
|
exit(0)
|
2013-04-17 21:41:41 +02:00
|
|
|
|
2013-04-19 22:06:05 +02:00
|
|
|
# preparse the argument to get the erbose element for debug mode
|
|
|
|
def parseGenericArg(argument,active):
|
|
|
|
if argument == "-h" or argument == "--help":
|
|
|
|
#display help
|
|
|
|
usage()
|
|
|
|
return True
|
|
|
|
elif argument[:2] == "-v":
|
|
|
|
if active==True:
|
|
|
|
if len(argument)==2:
|
|
|
|
debug.SetLevel(5)
|
|
|
|
else:
|
|
|
|
debug.SetLevel(int(argument[2:]))
|
|
|
|
return True
|
|
|
|
elif argument[:9] == "--verbose":
|
|
|
|
if active==True:
|
|
|
|
if len(argument)==9:
|
|
|
|
debug.SetLevel(5)
|
|
|
|
else:
|
|
|
|
if argument[:10] == "--verbose=":
|
|
|
|
debug.SetLevel(int(argument[10:]))
|
|
|
|
else:
|
|
|
|
debug.SetLevel(int(argument[9:]))
|
|
|
|
return True
|
|
|
|
elif argument == "-c" or argument == "--color":
|
|
|
|
if active==True:
|
|
|
|
debug.EnableColor()
|
|
|
|
return True
|
|
|
|
elif argument == "-f" or argument == "--force":
|
|
|
|
if active==True:
|
|
|
|
environement.SetForceMode(True)
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
# parse default unique argument:
|
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.path.append(os.path.dirname(__file__) + "/corePython/" )
|
|
|
|
for argument in sys.argv:
|
|
|
|
parseGenericArg(argument, True)
|
|
|
|
|
|
|
|
# now import other standard module (must be done here and not before ...
|
|
|
|
import module
|
|
|
|
import host
|
|
|
|
import buildTools
|
|
|
|
import host
|
|
|
|
import buildList
|
|
|
|
|
2013-04-18 22:09:45 +02:00
|
|
|
|
|
|
|
|
2013-04-17 21:41:41 +02:00
|
|
|
"""
|
2013-04-18 01:46:47 +02:00
|
|
|
Run everything that is needed in the system
|
2013-04-17 21:41:41 +02:00
|
|
|
"""
|
2013-04-18 01:46:47 +02:00
|
|
|
def Start():
|
2013-04-19 22:06:05 +02:00
|
|
|
actionDone=False
|
2013-04-18 01:46:47 +02:00
|
|
|
# parse all argument
|
2013-04-19 22:06:05 +02:00
|
|
|
for argument in sys.argv[1:]:
|
|
|
|
if True==parseGenericArg(argument, False):
|
|
|
|
None # nothing to do ...
|
|
|
|
elif argument == "dump":
|
|
|
|
module.Dump()
|
|
|
|
actionDone=True
|
|
|
|
elif argument[:11] == "--platform=" or argument[:3] == "-p=":
|
|
|
|
tmpArg=""
|
|
|
|
if argument[:3] == "-p=":
|
|
|
|
tmpArg=argument[3:]
|
|
|
|
else:
|
|
|
|
tmpArg=argument[11:]
|
|
|
|
# TODO ...
|
|
|
|
elif argument[:7] == "--mode=" or argument[:3] == "-m=":
|
|
|
|
tmpArg=""
|
|
|
|
if argument[:3] == "-m=":
|
|
|
|
tmpArg=argument[3:]
|
2013-04-18 01:46:47 +02:00
|
|
|
else:
|
2013-04-19 22:06:05 +02:00
|
|
|
tmpArg=argument[11:]
|
|
|
|
if "debug"==tmpArg:
|
|
|
|
environement.SetDebugMode(1)
|
|
|
|
elif "release"==tmpArg:
|
|
|
|
environement.SetDebugMode(0)
|
|
|
|
else:
|
|
|
|
debug.error("not understand build mode : '" + val + "' can be [debug/release]")
|
|
|
|
environement.SetDebugMode(0)
|
|
|
|
elif argument[:7] == "--tool=" or argument[:3] == "-t=":
|
|
|
|
tmpArg=""
|
|
|
|
if argument[:3] == "-t=":
|
|
|
|
tmpArg=argument[3:]
|
|
|
|
else:
|
|
|
|
tmpArg=argument[11:]
|
|
|
|
environement.SetCompileMode(tmpArg)
|
|
|
|
else:
|
|
|
|
buildList.Build(argument)
|
|
|
|
actionDone=True
|
|
|
|
# if no action done : we do "all" ...
|
|
|
|
if actionDone==False:
|
|
|
|
buildList.Build("all")
|
2013-04-17 21:41:41 +02:00
|
|
|
|
|
|
|
"""
|
2013-04-18 01:46:47 +02:00
|
|
|
When the user use with make.py we initialise ourself
|
2013-04-17 21:41:41 +02:00
|
|
|
"""
|
2013-04-18 01:46:47 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
debug.verbose("Use Make as a make stadard")
|
|
|
|
sys.path.append(buildTools.GetRunFolder())
|
|
|
|
debug.verbose(" try to impoert module 'Makefile.py'")
|
|
|
|
__import__("Makefile")
|
|
|
|
Start()
|
2013-04-17 21:41:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|