Page 1 of 1

Makefile patches

Posted: 13 Aug 2004 02:22
by cben
First, the shell's ``if`` can't be used to conditionalize make's ``$(error)``
because make variables are expanded and functions are evaluated before they get to the shell. This results in the `install` target never working, even when given INSTALL=1. Solution: use make's ``$(if)``.

Second, copying only ``*.grf`` files in the ``data`` subdir didn't produce a working isntall because it missed things like ``sample.cat``. Solution: copy all files there.

Code: Select all

--- openttd-0.3.3/Makefile      2004-07-14 18:46:12.000000000 +0300
+++ openttd/Makefile    2004-08-12 17:17:33.000000000 +0300
@@ -537,15 +537,15 @@
 ifndef OSX
 ifndef MORPHOS
 install:
-       @if [ "$(INSTALL)" == "" ]; then $(error make install is highly experimental at his state and not\
-       tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure makefile.config\
-       is set correctly up - run \"make upgradeconf\")
-       @if [ "$(DATA_DIR)" == "" ]; then $(error no install path set - check makefile.config)
+       @$(if $(INSTALL),,$(error make install is highly experimental at his state and not\
+               tested very much - use at your own risk - to use run \"make install INSTALL:=1\" - make sure makefile.config\
+               is set correctly up - run \"make upgradeconf\"))
+       @$(if $(DATA_DIR),,$(error no install path set - check makefile.config))
        mkdir -p $(DATA_DIR)/lang
        mkdir -p $(DATA_DIR)/data
        cp $(TTD) $(BINARY_INSTALL)
        cp lang/*.lng $(DATA_DIR)/lang
-       cp data/*.grf $(DATA_DIR)/data
+       cp data/* $(DATA_DIR)/data
 else   #MorphOS
 install:
        $(error make install is not supported on MorphOS)

Re: Makefile patches

Posted: 13 Aug 2004 08:49
by Bjarni
cben wrote:Second, copying only ``*.grf`` files in the ``data`` subdir didn't produce a working isntall because it missed things like ``sample.cat``. Solution: copy all files there.
That would not help at all since it copies the files from the data folder in the svn working copy, which is only the grf files we made yourself, not the TTD ones and not sample.cat.

Re: Makefile patches

Posted: 20 Aug 2004 13:32
by cben
Bjarni wrote:
cben wrote:Second, copying only ``*.grf`` files in the ``data`` subdir didn't produce a working isntall because it missed things like ``sample.cat``. Solution: copy all files there.
That would not help at all since it copies the files from the data folder in the svn working copy, which is only the grf files we made yourself, not the TTD ones and not sample.cat.
True, unless one copies the files there before the final install. It's not entirely clear from the readme where should you copy them. If you don't like the idea (I agree that it's just a quick hack), you can apply the patch without it.
The first part of the patch is more important: the install target doesn't run at all without it.
Also, I recommend to remove the INSTALL=1 test. It doesn't achieve anything except annoying the user. Its only purpose seems to warn the user that it's experimental; an echo at the end of the install and a note in the readme would be enough IMHO. Besides. the install target does work (after this patch) ;-).