Using a Makefile

Most projects around here use a Makefile to compile the project into a usable something like a grf file. Most makefiles are equipped with three functions:
  • make
  • make install
  • make clean

make compiles the usable something. make install copies that usable something into a directory that you specify in the Makefile.local file, but more on that later. make clean mostly removes anything that make created. The recommended makefile system is found in the Example newgrf makefile project also found here.

Running a Makefile

You have to run a makefile from the commandline.
  • Open a command prompt and cd to the directory in which the makefile is located that you want to run.
    (Windows Vista users: Use Windows Explorer to browse to the directory, hold shift and then rightclick somewhere inside the file list, choose Open command prompt here)
  • If you just want to compile and nothing else, type the following command and press Enter:
    make
  • If also want to install the compiled result (see further down to set the install dir in Makefile.local!), use:
    make && make install
  • The most advanced feature of most makefiles is to compile, install and cleanup all in one go. Run:
    make && make install && make clean

Makefile.local: configuring the makefile

A makefile is customizable through the Makefile.local file. An example of such a file is given in Makefile.local.sample. If there's no Makefile.local.sample in the repository, you can assume that the makefile is not customizable.

  • Copy Makefile.local.sample Makefile.local
  • Open Makefile.local using your favourite plain text editor. The contents of the file is usually commented.
  • Remove the # in front of INSTALLDIR to uncomment it.
  • Type the full installation path after INSTALLDIR =.
  • Save the changes.

Updating NFORenum

Once you've run a makefile that uses NFORenum, a .renum directory is created somewhere on your system. This directory contains a bunch of .dat files which should be updated.

  • Locate the .renum directory.
  • Visit http://users.tt-forums.net/dalestan/nforenum/.
  • At the bottom of that website a list of .dat files is shown. Download each .dat file and place it in the .renum directory, overwriting existing files.