Ticket #40400: patch-make.diff

File patch-make.diff, 2.6 KB (added by fabian@…, 11 years ago)
  • Makefile

    old new  
    1414#
    1515# Usage:
    1616#       make [platform=<your platform>] [DEBUG=1] all
    17 #       make [platform=<your platform>] <installdir=/path/to/install> install
     17#       make [platform=<your platform>] <DESTDIR=/path/to/install> install
    1818#       This makefile will attempt to detect your platform if not supplied.
    1919#
    2020# Author: Charles Nepveu
     
    4545PLATFORM      :=$(shell [ -z "$(platform)" ] && uname | tr "[A-Z]" "[a-z]" || echo "$(platform)" )
    4646SUPPORTED_PLATFORMS=linux netbsd freebsd openbsd darwin sunos gogocpe
    4747
    48 INSTALL_DIR   :=$(installdir)
    49 INSTALL_BIN   :=$(INSTALL_DIR)/bin
    50 INSTALL_MAN   :=$(INSTALL_DIR)/man
    51 INSTALL_TEMPL :=$(INSTALL_DIR)/template
     48DESTDIR   :=$(DESTDIR)
     49INSTALL_BIN   :=/bin
     50INSTALL_MAN   :=/man
     51INSTALL_CONF  :=/etc/gogoc
     52INSTALL_TEMPL :=$(INSTALL_CONF)/template
    5253
    5354
    5455SUBDIRS=$(PWD)/src/lib \
     
    6667LD_LIBRARIES=-lgogocpal -lgogocconfig -lgogocmessaging
    6768
    6869# Export these variables to sub-makes.
    69 export PLATFORM_DIR PLATFORM BIN_DIR OBJS_DIR TARGET DEBUG CC_INC_PATHS LD_LIB_PATHS LD_LIBRARIES INSTALL_DIR INSTALL_BIN INSTALL_MAN INSTALL_TEMPL
     70export PLATFORM_DIR PLATFORM BIN_DIR OBJS_DIR TARGET DEBUG CC_INC_PATHS LD_LIB_PATHS LD_LIBRARIES DESTDIR INSTALL_BIN INSTALL_MAN INSTALL_TEMPL DESTDIR
    7071
    7172
    7273#
     
    155156# This makefile target will install the gogoCLIENT.
    156157#
    157158check-gogoc-install:
    158         @[ -n "$(INSTALL_DIR)" ] || { \
     159        @[ -n "$(DESTDIR)" ] || { \
    159160            echo ; \
    160161            echo "Error: You must specify the install directory"; \
    161             echo "Syntax: make [platform=<os-type>] installdir=</path/to/install> install"; \
     162            echo "Syntax: make [platform=<os-type>] DESTDIR=</path/to/install> install"; \
    162163            echo ; \
    163164            exit 1;\
    164165        }
    165166
    166167install: check-gogoc-install all
    167         @mkdir -p $(INSTALL_DIR)
    168         @mkdir -p $(INSTALL_BIN)
    169         @mkdir -p $(INSTALL_MAN)
    170         @mkdir -p $(INSTALL_TEMPL)
     168        @mkdir -p $(DESTDIR)
     169        @mkdir -p $(DESTDIR)$(INSTALL_BIN)
     170        @mkdir -p $(DESTDIR)$(INSTALL_MAN)
     171        @mkdir -p $(DESTDIR)$(INSTALL_TEMPL)
     172        @mkdir -p $(DESTDIR)$(INSTALL_CONF)
    171173
    172174        @for dir in ${SUBDIRS}; do \
    173175            $(MAKE) -C $$dir install || exit 1; \
    174176        done
    175177
    176         @cp $(TARGET) $(INSTALL_BIN)
    177         @cp $(BIN_DIR)/gogoc.conf.sample $(INSTALL_BIN)
    178         @[ -f $(INSTALL_BIN)/gogoc.conf ] || { \
    179             cp $(INSTALL_BIN)/gogoc.conf.sample $(INSTALL_BIN)/gogoc.conf; \
     178        @cp $(TARGET) $(DESTDIR)$(INSTALL_BIN)
     179        @cp $(BIN_DIR)/gogoc.conf.sample $(DESTDIR)$(INSTALL_CONF)
     180        @[ -f $(DESTDIR)$(INSTALL_CONF)/gogoc.conf ] || { \
     181            cp $(DESTDIR)$(INSTALL_CONF)/gogoc.conf.sample $(DESTDIR)$(INSTALL_CONF)/gogoc.conf; \
    180182        }
    181183
    182184