Yaxmake : Yet another cross make.
Usage: yaxmake <options>
options:
-t or --toolkit=<toolkit>: gnu or msvc, gnu as default
-l or --language=<lang> : c or c++, c as default
-f or --file=<infile> : input file, default: yaxfile.py
-d or --debug : compile in debug mode
-c or --clean : clean generated file(s)
-V or --verbose : verbose mode
-v or --version : show version
-h or --help : show this menu
gnu - works with GCC/G++, Cygwin(not test), MinGW. msvc - microsoft visutal c++ compiler
yaxmake will not detect programming language (this might be supported in new version). Therefore, you should set language to 'c++', if you are developing a c++ project.
this has not been implemented yet.
this command should remove almost generated file(s). but as some file(s) could not track, we just left them in your project, you might remove these files manually. Such as: .exp (msvc), .lib (msvc dll) or others.
To compile a project as you plan, you should create an input file. As default, you should name it as "yaxfile.py". Of course, you could name whatever, but in this case, you should specify your input file with option: -f.
yaxmake.py -f=myname.xyz
or
yaxmake.py --file=whatever.abc
If you are working a C++ project, you'd like the following command line:
yaxmake.py --file=yaxfile.py --language=c++ --toolkit=msvc
or just:
yaxmake.py --language=c++ --toolkit=msvc
Let's consider a simple real project:
Files: hello.h + hello.c = hello.lib (static library)
Files: test.c + hello.lib = test.exe
Directory:
root +- hello.h
+- hello.c
+- test.c
We could write yaxfile.py as following:
env.static_library(target='hello', sources=['hello.c'])
env.console_app(target='test', sources=['test.c'], lpaths=['.'], libs=['hello'])
Okay, that's enough!
If you want to compile a dynamic library, try to replace the first line with the following:
env.dynamic_library('hello', ['hello.c'])
And here is a further demo:
# to create a lib file with dll in msvc toolkit
# we should use a def file
linkflags = ''
if env.getToolkit()=='msvc':
linkflags = '/DEF:hello.def'
env.dynamic_library(
target="bin/hello_dynamic",
sources=['hello.c'],
lflags=linkflags)
env.static_library(
target="bin/hello_static",
sources=['hello.c'])
env.console_app(
target='bin/test_dynamic',
sources=['test.c'],
lpaths=['bin'],
libs=['hello_dynamic'])
env.console_app(
target='bin/test_static',
sources=['test.c'],
lpaths=['bin'],
libs=['hello_static'])
The yaxmake supports following target:
- object
- console_app
- gui_app
- static_library
- dynamic_library
For more information, please see the YaxEnvironment in yaxmake/yaxlib/yenv.py.