Organizing your newgrf

Once you start using a makefile, you have to tell the makefile where to find the files which actually make your grf, which your grf consists of. Here I want to line out a structure which was proven to work.

Mostly you'll have a number of nfo files which needs processing, a number of pcx files which are the actual graphics and then you might have files like readme.txt, license.txt and possibly some spreadsheets which help you in the alignment process

Main newgrf dir
  • Makefile
  • Makefile.config
  • docs
    • readme.txt
    • license.txt
    • alignment.xls
  • sprites
    • nfo
      • languages
        • 7F_english.pnfo
        • 02_german.pnfo
      • section1
        • railengines1.pnfo
        • monorailengines1.pnfo
        • maglevengines1.pnfo
      • section2
        • railengines2.pnfo
        • monorailengines2.pnfo
        • maglevengines2.pnfo
      • header.pnfo
      • footer.pnfo
      • file1.pnfo
    • pcx
      • general.pcx
      • section1
        • engine1.pcx
        • engine2.pcx
      • section2
        • engine3.pcx
        • engine4.pcx
      • unused
        • alternative_engine1.pcx
        • idea_flatbedwagon.png
  • website

The italic parts are purely optional and not required. Whether you sort your nfo files in subdirectories or put them straight into the nfo dir is up to you and probably depends upon the amount of the files. You may have noticed that I called all nfo files pnfo instead of nfo. This is to indicate that these files may be subject to some post processing - and may it only be the fact that all those files are subsequently taken and just merged into one huge nfo file which then is _renum_bered and _grfcodec_ed.

Automatic versioning and title generation of your newgrf

Each newgrf has an action 8 which defines its name and description. If within the NFO you replace the name by } you can have makefile automatically name it with the proper version as defined in the repository. There are two default names generated: GRF_NAME--nightly-rXX or GRF_NAME-??VERSION_STRING??
The latter is generated, if the repository version has a tag - e.g. you name a certain revision within your repository 0.1alpha and then that revision is taged as the alpha version and your grf title and bundle filename will be adopted accordingly.
In order to nicely name your newgrf you want to set two variables, the displayed title ingame and the actual filename (without extension like .grf):
GRF_NAME = My fancy NewGRF name
FILENAME = fancynewgrf

The actual directory descriptions are, of course also needed by Makefile:
HEADER = header.pnfo
FOOTER = footer.pnfo
OTHERS = file1.pnfo file2.pnfo
PCX_FILES = section1/engines1.pcx section1/engines2.pcx

Look e.g. at the 2cctrainset for a good example of a modular makefile.