Magic Makefile is a powerful way of managing the software build/make process.
Version: 5Magic Makefile is a powerful way of managing the software build/make process. Effectively it replaces the need for gnu autoconf and automake and is even more automatic.
Operating System: Linux
What does "Even more automatic" mean? It means:
· You don't have to list your source files anywhere. The magicmakefile looks for all appropriate files in the appropriate places
· You don't have to manually manage header file dependencies
· You don't have to manually manage test scripts
· You can easily provide specialized source code for various platforms
However unlike gnu autoconf, it does not spend any time interrogating the system for capabilities. It is up to you, the programmer, to know about the platforms that you support and write code for them.
The magic.mak makefile, and its companion autobuild.sh script allow you to:
· Build a statically linked library with config-tool for ease of use
· Build test programs, example programs, tool programs, and gui programs which use this library
· Run test programs and test scripts automatically, possibly under valgrind
· Build doxygen docs
· Create emacs TAGS and vi tags files from the source code
· Install the resultant binaries, development files, or doxygen docs into a system
· Build a zip or tgz package of the installable files
· Build platform specific packages via the external tools: epm, nsis, or dpkg
· Ship resultant packages or test results to another server via scp
· Easily cross compile the code for mingw32 or embedded linux systems
· Autobuild packages, tests, and ship them from scratch with a single command line for use in autobuild farms
· Create a qmake.pro file so qt/qmake users can build with their tools
· Build gui programs with WxWidgets, GTK, win32 and Mac OS X Cocoa
· Build macosx universal programs and libraries targetting 10.4 (Tiger) or 10.5 (Leopard)
All you have to do make the appropriate subdirs and put your source code in the appropriate directories. Everything else is automatic.
A key point of building programs with the magic makefile is the following:
· All source code in the src directory will be put into a library
· Every source file that has a 'main()' function must live in one of the directories: tools, examples, or tests. A program must be a single source file and it is linked with the library of code in the src directory.
· The gui directory is special and still experimental. You can make subdirs called win32, macosx, macosx-xcode, gtk, wx. How to use these subdirs is not documented yet.
From fresh project without svn:
svn export http://opensource.jdkoftinoff.com/jdks/svn/trunk/magicmakefile/branches/v5/autobuild
Edit the files project.mak and project.sh so that they include the proper descriptions, copyright, and author information.
Put your h files in the include dir, your c++ files (.cpp or .cc) in the src dir, any single c++ file test programs in the tests dir, any single c++ file tools in the tools dir, any single file c++ example programs in the examples dir. In each of these dirs you can make subdirs for posix, macosx, linux, win32, for platform specific source code.
After that you have a few options to build it. During normal development you want to make sure all intermediate generated files are put in a separate dir. Do this by 'mkdir build; cd build'. Then run the *configure* script to generate the primare GNUmakefile. For instance use one of these command lines:
Another way to do a more complex build is with the *autobuild.sh* script:
Run the following for more information: