Maxmake builds a Windows executable with a single keyboard click. You can copy, move, and rename the patcher folder, and the makefile still works. You can automatically include your own files in the collective, add writable files, and replace resource files, simply by putting them in a subfolder of the patcher's folder. You can change the hotkeys and directly modify the makefile to your own needs by editing the makefile with its included editor.

Maxmake Control Panel
Maxmake Control Panel

1. Quick Start

  1. Download Maxmake, unzip anywhere and install Autohotkeys (included in Maxmake's ~/bin/ folder).
    buy

    MaxMake 2.10 (Max 7)

    Cost: $0.00

  2. Double-click the _demo.ahk file and press the Run Make Now button. The demo patch opens an audio file for the buffer object, opens a pattrstorage.json file containing presets, and starts preset 1. That turns on the play~ object, sets the volume level, opens the storage window, and opens the audio panel.

2. Details

Here are the root directory's files and all subdirectories in the distribution.

Hide LIne Numbers
  1. %root%
  2. │   buildscript.txt
  3. │   sound.wav
  4. │   _demo.ahk
  5. │   _demo.maxpat
  6. │   __readme.txt
  7. ├───inc
  8. ├───installers
  9. │   ├───Autohotkey
  10. │   │   └───Compiler
  11. │   └───Other
  12. │       ├───CommandWindowHere
  13. │       ├───notepad++_syntaxHighlighter
  14. │       └───sublime_syntaxHighlighter
  15. ├───resources
  16. └───support
By default:
  • MaxMake compiles from a patch in the same directory as the script, with the same filename as the script.
  • MaxMake builds an executable into a desktop folder with the same name as the patch.
You can change the patch filename and destination directory with MaxMake's dialog manually, or you can modify MaxMake's built-in automation features.

2.1. Built-In Automation

  • 2.1.1. Readme Autogeneration

    When it has finished copying files, and before it starts the Max compiler, MaxMake shows you the readme file it has created. You can edit it in the dialog, or change the variables and strings in the makefile to create a different readme. This gives you a chance to see what the make will do before Max starts compiling. The readme.txt file is put in the built exectuable's .\support\ subdirectory.
    Automatically Generated readme
    Automatically Generated readme
  • 2.1.2. Creating a new make

    Copy the makefile script into the directory containing the patch you want to compile, and rename it the same as the patch; or change the makefile defaults with the Make Tools. Double-click the new makefile to replace the previous one.
  • 2.1.3. Including Files in the Collective

    If the patch's folder contains a subfolder called ~/inc/, MaxMake adds all the files in it to the collective. The ~/inc/ folder should contain all your own read-only files (including bpatcher and other subpatches) in a flat directory, and also, any files which the standalone's console reports as missing from the collective (see the FAQ below). The makefile says the includes in scriptfile.txt, so you can reuse it manually if you don't want to run a full make.
  • 2.1.4. Overwriting Resource Files

    If the patcher's folder contains a subfolder called ~/resources/, then its contents, including subfolders, overwrite those in the built application's ~/resources/ folder, after the Max compiler tools finish copying files there. You can use this to fix bugs in resource files. .
  • 2.1.5. Adding Writable Files

    If the patcher's folder contains a subfolder called ~/support/, its contents are copied to the application's ~desktop/patchname/support/ folder. Files which are included in the collective are read-only, so use the ~/support/ folder for any writable files that your patch needs. Max standalones requires this location for all writable files.
    • Note, you cannot specify files as arguments to objects like ~buffer, ~coll, ~dict, or ~pattrstorage. Instead, send them a 'read' message containing the file's absolute path. Then the executable can always find them. The included demo patch first creates absolute paths for either the patch or standalone in the 'thisdir' subpatch. The path generation and file read operations are all inside the 'thisdir' subpatch.
      MaxMake Demo Patch
      MaxMake Demo Patch

      Very specific pattrstorage~ attributes are required for storing pattrstorage.json in the .external \support\ folder. Please see the patch included in the download.

2.2. Customization

  • 2.2.1. Included code editor

    If you want code highlighting and autocompletion in the script, MaxMake includes an installer for the Sci editor in its ~/bin/ folder, as well as plugins for Sublime and Notepad++. The Sci editor is older, but it includes a dialog box creator and other tools for Autohotkey.
    The Code Editor included with MaxMake
    The Code Editor included with MaxMake
  • 2.2.2. Changing makefile variables

    The script is currently ~400 lines, but all the variables you might want to change are at the top of the file.
    Hide LIne Numbers
    1. #Warn                      ; enables strict debugging
    2. #SingleInstance force      ; ensures only one instance of script
    3. #NoEnv                     ; no automatic DOS environment variables
    4. #NoTrayIcon                ; has its own UI
    5. SendMode Input             ; AHKv1.0.43+ compatibility
    6. CoordMode, mouse, screen   ; set 'screen' or 'window' coords
    7. ; user variables ; *********************************************************************
    8. scriptTitle = MaxMake 2.1
    9. Author      = Ernest Meyer
    10. URL         = https://www.yofiel.com
    11. Compiler    = Max 7.3.4
    12. Maker       = AHK v1.1.27.03
    13. readmetxt   = Readme file generated with %scriptTitle% defaults.
    14. ; system variables *********************************************************************
    15. scriptfile  = %A_ScriptName%                    ; pull patchername from script's name
    16. StringTrimRight, scriptname, scriptfile, 4        ; remove extension from script filename
    17. patcher     = %scriptname%                        ; set patcher to same name as script
    18. thisdir     = %A_ScriptDir%                        ; pull current dir from script's dir
    19. srcdir      = %thisdir%                            ; build patch from same dir as script
    20. EnvGet, homepath, HOMEPATH                        ; pull userdir from environment
    21. destdir     = C:%homepath%\Desktop\%patcher%\    ; build to user's desktop
    22. buildWindow = Build `"%patcher%.maxpat`"        ; Max7 build window title
    23. thispatcher = %thisdir%\%patcher%.maxpat        ; full path to patcher
    24. FileGetTime, patchCreated, %thispatcher%, C        ; get file created time
    25. FileGetTime, patchModified, %thispatcher%, M    ; get file modified time
    26. FormatTime, compileTime, , dddd MMMM yyyy h:mtt ; get compile time
    27. FormatTime, patchCreated,  %patchcreated%, dddd MMMM yyyy h:mtt
    28. FormatTime, patchModified, %patchmodified%, dddd MMMM yyyy h:mtt
    29. ; Readme file **************************************************************************
    30. r = ---------------------------------------------`n
    31. r = %r% %patcher%.exe - README`n
    32. r = %r% ---------------------------------------------`n
    33. r = %r% Author:               %author% `n
    34. r = %r% Website:              %url% `n
    35. r = %r% Patch Created:        %patchcreated% `n 
    36. r = %r% Last Modified:        %patchmodified% `n
    37. r = %r% Compiled at:          %compileTime% `n
    38. r = %r% Compiled on:          %compiler% by %scriptName% `n
    39. r = %r% ---------------------------------------------`n
    40. r = %r% Compiled from:        %thisdir% `n
    41. r = %r% Collective Includes:  %thisdir%\inc\ `n
    42. r = %r% Writable files:       %thisdir%\support\ `n
    43. r = %r% Replaced resources:   %thisdir%\resources\ `n
    44. r = %r% Makefile:             %thisdir%\%scriptfile% `n 
    45. r = %r% Makefile compiled by: %maker% `n
    46. r = %r% ---------------------------------------------`n
    47. r = %r% %ReadmeTxt% `n
    48. OpenDialog: ; *********************************************************************
    49. ....
  • 2.2.3. Changing the hotkeys

    The hotkeys just call subroutines, so it's easy to change them.
    Hide LIne Numbers
    1. HOTKEYS: ;***********************************************************************
    2. ;  ^ = Control;    ! = Alt;    + = Shift;     # = Windows key;     * = Wildcard;
    3. ;  & = Combo keys; Others include ~, $, UP (see "Hotkeys" in Help)
    4. ^j::    ; ctrl-j reopens dialog
    5.         gosub, OpenDialog
    6.         return
    7. ^k::    ; ctrl-k is for fast makefile compilation
    8.     run, %A_ScriptName%
    9.     return
  • 2.2.4. Customizing the make

    The make operations are divided into subroutines, so you can easily disable any particular stage you don't want.
    Hide LIne Numbers
    1. MAKE: ; ***************************************************************************
    2.     gosub, checkdata
    3.     gosub, openPatcher      ; brings patcher to front, opening it if desired
    4.     ;gosub, openConsole      ; positions console, returns focus to patcher
    5.     gosub, openBuildWindow    ; opens the build window, positions it
    6.     gosub, makeDirs              ; creates inc\, support\, & resources\ dirs
    7.     gosub, includeCollective  ; adds files to collective from %patcher%\inc\
    8.     ;gosub, addSupportFiles     ; adds writable files to .exe \support\ folder
    9.     gosub, copyFiles          ; copies readme, etc, to .exe \support\ folder
    10.     gosub, makeReadme         ; creates readme.txt, prompts whether to continue
    11.     gosub, savebuild          ; compiles & saves Max7 build to destdir
    12.     gosub, closeBuildWindow   ; closes the build window
    13.     ;gosub, replaceResources   ; replaces Max files in .exe\resources\ folder
    14.     gosub, openExplorerWindow ; opens explorer window with focused file
    15.     return

2.3. Known limitations

  • 2.3.1. Filename

    - The current MaxMake manipulates windows by their titles. The makefile and patcher therefore cannot contain the string which is set as the MaxMake window title. You can easily change the Maxmake window title in the script's VARIABLES section.
  • 2.3.2. Font sizes

    - To manipulate panels which do not have hotkeys in Max7, the script currently sends mouse clicks rather than iterating through the control object hWnd IDs. If you have non-standard font sizes in Windows 10, the mouse clicks will not be in the right places. Currently, if using non-standard font sizes, you need to edit the mouse-click positions in the script, add hWnd IDs in the script, or reset your font size to the recommended 100% setting.
Personalize->Display->Scale must be 100%
Personalize->Display->Scale must be 100%

3. FAQ

3.1. Why use a makefile?

It may appear that the Project Window provides an elegant drag-and-drop solution for adding files to the collective, but it has some disadvantages.

  • There's still alot of menus and file dialogs to navigate. This makefile does it all with one key press.
  • When making a custom include file for the collective, the paths to included files are absolute, so they are not portable between users, folders, machines, or operating systems. Because the files must be defined with absolute paths, you have to change the build script manually, every time. .
  • Projects copy and move source files around. From the perspective of make management, that's all unnecessary complication.
  • The makefile can add a readme.txt file to the output build and zip it up automatically.
  • The makefile can add external files and replace files which are broken in the Max distribution.
  • The makefile can build 32-bit and 64-bit versions with one key click.

3.2. Why AutoHotkey?

Autohotkey is a free, small Windows program which attaches your scripted key sequences and mouse clicks to any keyboard key combination of your choice. With the Max standalone and Make settings in Maxmake, you can quickly create a reliable Windows executable, with ~15MB zipfile baseline, with a single key click.

3.3. Why develop on Windows?

If you are developing a standalone application, you will want to build it for both Windows and MacOS, so you will probably have access to a Windows operating system already. In this case, it makes sense to develop builds on Windows rather than MacOS, because on Windows the actual compilation is almost spontaneous compared to doing the same on a Mac. But if you insist on using MacOS for builds, despite it being much slower, there is a shareware app called Keyboard Maestro, which I did own in 1996, and maybe it is better for some people. But getting something working on it is about the same work, so I see no point in paying for it when Windows is much faster anyway. With this script, you can single-click compile as many times as you need to get it working. Then, when you have a working build, you can do the same manually just once on MacOS.

What about the directory slash direction difference on Windows and MaxOS? In the past this was complicated by the need to reverse slashes depending on the OS, but that is no longer a problem as forward slashes now work in Windows paths.If you wish to reverse slashes for display purposes, here is a Max subpatch patch to do it, included in the download.

reversing slashes
reversing slashes

3.4. Why add resource files to the collective?

After building MaxMake 1 on Windows 10 with the Max v7.3.4 64-bit version, the executable runs with no apparent problem. However, the console displays error messages that three files are not in the collective, even though they are present in the application's .\Resources\ folder (see following illustration).

MaxMake 1, First Runtime Error
MaxMake 1, First Runtime Error

It's not possible to solve the above noted problem of missing files with the Standalone object's options. Enabling "Search for Missing Files" sometimes removes errors, but when building an application, means the application won't work for someone else. Similarly, enabling "CEF Support" or "Include C74 Resources" sometimes even fixed application errors, but it does so by including ALL possible files, up to 400MB, so they are not practical solutions for standalone sharing, It does also perhaps help to enable "Make Application Subfolder Search Path", but that is not the root of this problem. In the above case the file is present, but not properly linked from the collective .mxf to the app's \resources\interfaces files. Max 7.3.4 is thinking that the listed image files are in the collective, rather than the resources folder, so therefore, adding these files to those which should be included in the collective will remove the error messages. Adding files to the collective is already well supported for the inclusion of other files, such as audio clips, in the project or Max's "build Application" menu.

It's possible the missing files don't affect your needs, and that future Max versions fix the problem. Maxmake2 is a simply a systematic solution to rapidly solving such problems when yo have them.

3.5. Why overwrite resource files?

As one example, when you open the Audio Status window in a built executable, it displays a large number of errors. These are all caused by a JavaScript file, ./executable_folder\resources\interfaces\interfacecolor.js, attempting to create a Dict object to hold the default interface colors. Neither Dict not Buffer JavaScript objects are currently working in Max7.3.4 standalones, so no settings in the standalone~ object can fix the colors. Fortunately the error only affects the color of the 'Audio on/off' LED indicator, which just appears black regardless the audio status, unless the interface.js file is fixed.

Max7.3.4 Errors in Audio Status Window
Max7.3.4 Errors in Audio Status Window