# target 'install' which installs the grf ################################################################ # Install targets ################################################################ ################################################################ # OS-specific definitions and paths ################################################################ # If we are not given an install dir explicitly we'll try to # find the default one for the OS we have ifndef INSTALL_DIR # Determine the OS we run on and set the default install path accordingly OSTYPE:=$(shell uname -s) # Check for OSX ifeq ($(OSTYPE),Darwin) INSTALL_DIR :=$(HOME)/Documents/OpenTTD/newgrf/$(BASE_FILENAME) endif # Check for Windows / MinGW32 ifeq ($(shell echo "$(OSTYPE)" | cut -d_ -f1),MINGW32) # If CC has been set to the default implicit value (cc), check if it can be used. Otherwise use a saner default. ifeq "$(origin CC)" "default" CC=$(shell which cc 2>/dev/null && echo "cc" || echo "gcc") endif WIN_VER = $(shell echo "$(OSTYPE)" | cut -d- -f2 | cut -d. -f1) ifeq ($(WIN_VER),5) INSTALL_DIR :=C:\Documents and Settings\All Users\Shared Documents\OpenTTD\newgrf\$(BASE_FILENAME) else INSTALL_DIR :=C:\Users\Public\Documents\OpenTTD\newgrf\$(BASE_FILENAME) endif endif # Check for Windows / Cygwin ifeq ($(shell echo "$(OSTYPE)" | cut -d_ -f1),CYGWIN) INSTALL_DIR :=$(shell cygpath -A -O)/OpenTTD/newgrf/$(BASE_FILENAME) endif # If non of the above matched, we'll assume we're on a unix-like system ifeq ($(OSTYPE),Linux) INSTALL_DIR := $(HOME)/.openttd/newgrf/$(BASE_FILENAME) endif endif install: $(DIR_NAME).tar ifeq ($(INSTALL_DIR),"") $(_E) "No install dir defined! Aborting." $(_E) "Try calling 'make install -D INSTALL_DIR=path/to/install_dir'" $(_V) false endif $(_E) "[INSTALL] to $(INSTALL_DIR)" $(_V) install -d $(INSTALL_DIR) $(_V) install -m644 $< $(INSTALL_DIR)