This is a helper for Factorio mod makers.
It is a Makefile (tested only with GNU make) that automates the creation of mod
packages from source, including performing some simple keyword expansion (of
tokens like {{VERSION}}
) in the info.json
and *.lua
files.
To start using this makefile for your package, you'll need to create a few very simple files:
-
The file
PKG_NAME
should contain the name of your mod package. Create it with something likeecho My-Awesome-Mod > PKG_NAME
. -
The file
VERSION
should contain your current package version. Create it with something likeecho 1.0.0 > VERSION
.- Note: this file is optional. You can also supply the version at run-time,
either by setting the environment variable VERSION, or by passing it as a
make
argument as inmake VERSION=1.0.2
. - Alternately, you can create the file
SHORT_VERSION
, which should contain a two-part version number (e.g.,0.6
) -- the third part will be filled in by appending the number of commits since the last tag matching thev[0-9]*.[0-9]*
wildcard.
- Note: this file is optional. You can also supply the version at run-time,
either by setting the environment variable VERSION, or by passing it as a
-
The file
PKG_COPY
should contain a list of any files or folders that should be directly copied to the output package, i.e., without any variable expansion. Note that lua files are automatically included regardless of where they are in the directory tree. Create it with something likeecho locale > PKG_COPY
.- Note: the file may contain the names separated by spaces or newlines -- make doesn't care.
- Further note: this file is also optional -- if left out,
info.json
,*.md
, and*.lua
files will be automatically included.
Once your setup is completed, it should be as simple as typing make
-- the
output package will be left in the pkg
directory, which will be created if
necessary.
Should you wish it, you may invoke the specific target make package
, and
there is also a make clean
that will clean up the intermediate files, should
you wish to do a completely fresh repackaging.
It is possible to insert some tags into your info.json
or *.lua
that will
get automatically replaced with the right values from your current
configuration.
At present, there are two possible tags (and they are case-sensitive):
-
{{MOD_NAME}}
(including the braces) will get replaced with the package name, as set in thePKG_NAME
file. So if yourinfo.json
says"name":"{{MOD_NAME}}"
, it will be replaced by"name":"My-Awesome-Mod"
. -
{{VERSION}}
(including the braces) will get replaced with the version, given as explained above. Again, this is most useful for yourinfo.json
--"version":"{{VERSION}}"
will become"version":"1.0.2"
. -
{{__FILE__}}
(including the braces and underscores) will get replaced by the path of the file being processed, relative to themake
working directory. In most cases, this should be the plain filename, or something likesubdir/file.lua
. This is occasionally useful (for, e.g., logging warnings).
The source of factorio-mod-makefile is Copyright 2015 Octav "narc" Sandulescu. It is licensed under the MIT license, available in this package in the file LICENSE.md.
12 'Stop' errors were encountered during the development of this tool. All of them were terminated with extreme prejudice.