Make And MXMLC For Compilation

From Flash Game Dojo

Jump to: navigation, search
More Snippets
Flixel
FlashPunk

To simplify the use of MXMLC, you can use make. This enables you to specify where Flixel/FlashPunk is located instead of copying it into each of your projects, and shortens what you need to type in order to compile. Make is usually pre-installed for you if you are using OS X or Linux, but must be installed separately in Windows.

To get started, create a file and name it "Makefile" (without quotes).

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

actionscript, ada, apache, asm, asp, bash, c, c_mac, caddcl, cadlisp, cpp, csharp, css, d, delphi, diff, html4strict, java, javascript, lisp, lua, matlab, mpasm, nsis, objc, oobas, oracle8, pascal, perl, php, php-brief, python, qbasic, smarty, sql, vb, vbnet, vhdl, visualfoxpro, xml

Important: whitespace is significant in a makefile. Make sure to type a single tab for the final line of your makefile.

  • SRC is a path that contains all your game source files, so that make can check which have changed. (This means that if you type make twice in a row, it skips compilation the second time, since you haven't made any changes between the two runs.) To add all ActionScript files contained in the same folder as your makefile, you can simply write "*.as".
  • FLIXEL is the path to your Flixel or FlashPunk source directory.
  • MAIN is the ActionScript file that serves as your entrypoint.
  • SWF is what the compiled SWF file will be named.
  • MXMLC is the path to the Flash compiler mxmlc. If you have fcsh-wrap you can set MXMLC = fcsh-wrap for improved compile times.

Place your makefile in the same directory as your project file. To run the make process, navigate to your project folder from a command prompt and type:

make

That's it!

Build & Run

You can also configure the script to build your game and run it if the build was successful. To do this, you simply add a new make task to your makfile

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

actionscript, ada, apache, asm, asp, bash, c, c_mac, caddcl, cadlisp, cpp, csharp, css, d, delphi, diff, html4strict, java, javascript, lisp, lua, matlab, mpasm, nsis, objc, oobas, oracle8, pascal, perl, php, php-brief, python, qbasic, smarty, sql, vb, vbnet, vhdl, visualfoxpro, xml

This basically tells make that the 'run' tasks depends on the $(SWF) task (the one which compiles).

If you add this task just above the other one, it will be the default one to execute when we run 'make'. Otherwise you will need to run 'make run'

Personal tools