1# Time-stamp: <08/02/28 10:30:06 ptr> 2# 3# Copyright (c) 1997-1999, 2002, 2003, 2005-2008 4# Petr Ovtchenkov 5# 6# Portion Copyright (c) 1999-2001 7# Parallel Graphics Ltd. 8# 9# Licensed under the Academic Free License version 3.0 10# 11 12ifdef TARGET_OS 13TARGET_NAME := ${TARGET_OS}- 14else 15TARGET_NAME := 16endif 17 18BASE_OUTPUT_DIR := obj 19PRE_OUTPUT_DIR := $(BASE_OUTPUT_DIR)/$(TARGET_NAME)$(COMPILER_NAME) 20OUTPUT_DIR := $(PRE_OUTPUT_DIR)/so$(EXTRA_DIRS) 21OUTPUT_DIR_DBG := $(PRE_OUTPUT_DIR)/so_g$(EXTRA_DIRS) 22ifndef WITHOUT_STLPORT 23OUTPUT_DIR_STLDBG := $(PRE_OUTPUT_DIR)/so_stlg$(EXTRA_DIRS) 24endif 25 26# file to store generated dependencies for make: 27DEPENDS_COLLECTION := $(PRE_OUTPUT_DIR)/.make.depend 28 29# catalog for auxilary files, if any 30AUX_DIR := $(PRE_OUTPUT_DIR)/.auxdir 31 32# I use the same catalog, as for shared: 33OUTPUT_DIR_A := $(OUTPUT_DIR) 34OUTPUT_DIR_A_DBG := $(OUTPUT_DIR_DBG) 35ifndef WITHOUT_STLPORT 36OUTPUT_DIR_A_STLDBG := $(OUTPUT_DIR_STLDBG) 37endif 38 39BASE_INSTALL_DIR ?= /usr/local 40 41BASE_INSTALL_LIB_DIR ?= $(DESTDIR)${BASE_INSTALL_DIR} 42BASE_INSTALL_BIN_DIR ?= $(DESTDIR)${BASE_INSTALL_DIR} 43BASE_INSTALL_HDR_DIR ?= $(DESTDIR)${BASE_INSTALL_DIR} 44 45INSTALL_LIB_DIR ?= ${BASE_INSTALL_LIB_DIR}/${TARGET_NAME}lib 46INSTALL_LIB_DIR_DBG ?= ${BASE_INSTALL_LIB_DIR}/${TARGET_NAME}lib 47ifndef WITHOUT_STLPORT 48INSTALL_LIB_DIR_STLDBG ?= ${BASE_INSTALL_LIB_DIR}/${TARGET_NAME}lib 49endif 50INSTALL_BIN_DIR ?= ${BASE_INSTALL_BIN_DIR}/${TARGET_NAME}bin 51INSTALL_BIN_DIR_DBG ?= ${INSTALL_BIN_DIR}_g 52ifndef WITHOUT_STLPORT 53INSTALL_BIN_DIR_STLDBG ?= ${INSTALL_BIN_DIR}_stlg 54endif 55INSTALL_HDR_DIR ?= ${BASE_INSTALL_DIR}/include 56 57ifndef WITHOUT_STLPORT 58OUTPUT_DIRS := $(OUTPUT_DIR) $(OUTPUT_DIR_DBG) $(OUTPUT_DIR_STLDBG) \ 59 $(OUTPUT_DIR_A) $(OUTPUT_DIR_A_DBG) $(OUTPUT_DIR_A_STLDBG) 60else 61OUTPUT_DIRS := $(OUTPUT_DIR) $(OUTPUT_DIR_DBG) \ 62 $(OUTPUT_DIR_A) $(OUTPUT_DIR_A_DBG) 63endif 64 65ifndef WITHOUT_STLPORT 66INSTALL_LIB_DIRS := $(INSTALL_LIB_DIR) $(INSTALL_LIB_DIR_DBG) $(INSTALL_LIB_DIR_STLDBG) 67INSTALL_BIN_DIRS := $(INSTALL_BIN_DIR) $(INSTALL_BIN_DIR_DBG) $(INSTALL_BIN_DIR_STLDBG) 68else 69INSTALL_LIB_DIRS := $(INSTALL_LIB_DIR) $(INSTALL_LIB_DIR_DBG) 70INSTALL_BIN_DIRS := $(INSTALL_BIN_DIR) $(INSTALL_BIN_DIR_DBG) 71endif 72 73# sort will remove duplicates: 74OUTPUT_DIRS := $(sort $(OUTPUT_DIRS)) 75INSTALL_LIB_DIRS := $(sort $(INSTALL_LIB_DIRS)) 76INSTALL_BIN_DIRS := $(sort $(INSTALL_BIN_DIRS)) 77INSTALL_DIRS := $(sort $(INSTALL_LIB_DIRS) $(INSTALL_BIN_DIRS)) 78 79PHONY += $(OUTPUT_DIRS) $(INSTALL_DIRS) $(AUX_DIR) 80 81define createdirs 82@for d in $@ ; do \ 83 if [ -e $$d -a -f $$d ] ; then \ 84 echo "ERROR: Regular file $$d present, directory instead expected" ; \ 85 exit 1; \ 86 elif [ ! -d $$d ] ; then \ 87 mkdir -p $$d ; \ 88 fi ; \ 89done 90endef 91 92$(OUTPUT_DIRS): 93 $(createdirs) 94 95$(INSTALL_DIRS): 96 $(createdirs) 97 98$(AUX_DIR): 99 $(createdirs) 100