Loading

Paste #p8tmhtbch

  1. # target 'install' which installs the grf
  2. ################################################################
  3. # Install targets
  4. ################################################################
  5. ################################################################
  6. # OS-specific definitions and paths
  7. ################################################################
  8.  
  9. # If we are not given an install dir explicitly we'll try to
  10. #    find the default one for the OS we have
  11. ifndef INSTALL_DIR
  12.  
  13. # Determine the OS we run on and set the default install path accordingly
  14. OSTYPE:=$(shell uname -s)
  15.  
  16. # Check for OSX
  17. ifeq ($(OSTYPE),Darwin)
  18. INSTALL_DIR :=$(HOME)/Documents/OpenTTD/newgrf/$(BASE_FILENAME)
  19. endif
  20.  
  21. # Check for Windows / MinGW32
  22. ifeq ($(shell echo "$(OSTYPE)" | cut -d_ -f1),MINGW32)
  23. # If CC has been set to the default implicit value (cc), check if it can be used. Otherwise use a saner default.
  24. ifeq "$(origin CC)" "default"
  25.     CC=$(shell which cc 2>/dev/null && echo "cc" || echo "gcc")
  26. endif
  27. WIN_VER = $(shell echo "$(OSTYPE)" | cut -d- -f2 | cut -d. -f1)
  28. ifeq ($(WIN_VER),5)
  29.     INSTALL_DIR :=C:\Documents and Settings\All Users\Shared Documents\OpenTTD\newgrf\$(BASE_FILENAME)
  30. else
  31.     INSTALL_DIR :=C:\Users\Public\Documents\OpenTTD\newgrf\$(BASE_FILENAME)
  32. endif
  33. endif
  34.  
  35. # Check for Windows / Cygwin
  36. ifeq ($(shell echo "$(OSTYPE)" | cut -d_ -f1),CYGWIN)
  37. INSTALL_DIR :=$(shell cygpath -A -O)/OpenTTD/newgrf/$(BASE_FILENAME)
  38. endif
  39.  
  40. # If non of the above matched, we'll assume we're on a unix-like system
  41. ifeq ($(OSTYPE),Linux)
  42. INSTALL_DIR := $(HOME)/.openttd/newgrf/$(BASE_FILENAME)
  43. endif
  44.  
  45. endif
  46.  
  47. install: $(DIR_NAME).tar
  48. ifeq ($(INSTALL_DIR),"")
  49.     $(_E) "No install dir defined! Aborting."
  50.     $(_E) "Try calling 'make install -D INSTALL_DIR=path/to/install_dir'"
  51.     $(_V) false
  52. endif
  53.     $(_E) "[INSTALL] to $(INSTALL_DIR)"
  54.     $(_V) install -d $(INSTALL_DIR)
  55.     $(_V) install -m644 $< $(INSTALL_DIR)

Comments