# Copyright (c) 1997-2007 # Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany) # http://www.math.tu-berlin.de/polymake, mailto:polymake@math.tu-berlin.de # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version: http://www.gnu.org/licenses/gpl.txt. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #----------------------------------------------------------------------------- # $Project: polymake $$Id: utils.make 7546 2007-01-08 16:34:56Z gawrilow $ PERL := perl export PERL ifdef _allow_lacking_BuildDir PerlArch := $(shell eval `$(PERL) -V:archname -V:version`; echo $$archname $$version) PerlVersion := $(word 2,$(PerlArch)) PerlArch := $(word 1,$(PerlArch)) endif ifndef BuildDir BuildDir := $(wildcard $(ProjectTop)/build) endif ifndef BuildDir ifeq "$(origin Arch)" "command line" BuildDir := $(wildcard $(ProjectTop)/build.$(Arch)) else Machine := $(shell uname -m) Arch := $(Machine) BuildDir := $(wildcard $(ProjectTop)/build.$(Arch)) ifndef BuildDir Arch := $(PerlArch) BuildDir := $(wildcard $(ProjectTop)/build.$(Arch)) endif ifndef BuildDir ifeq "$(shell uname -s)" "Darwin" Arch := darwin BuildDir := $(wildcard $(ProjectTop)/build.$(Arch)) else Arch := $(Machine) endif endif endif ifeq "$(BuildDir)$(_allow_lacking_BuildDir)" "" $(error BuildDir undefined) endif endif # recursively expand a variable which may contain names of other variables _expand_var = $(foreach word,$(1),$(if $($(word)),$(call _expand_var,$($(word))), $(word))) # convert a space-separated list into a colon-separated path _empty:= _space:=$(_empty) $(_empty) _list2path = $(subst $(_space),:,$(strip $(1))) # suffixes of C++ source files (not headers!) CXX_suffixes := cc cpp C # list all C++ sources in a directory _list_CXX_sources = $(notdir $(wildcard $(addprefix $(1)/*., $(CXX_suffixes)))) # list all subdirectories of the current directory _list_dirs = $(shell $(if $(1),cd $(1) || exit 1;) for d in *; do [ -d $$d ] && echo $$d; done) override .svn := $(wildcard $(ProjectTop)/.svn) ifdef .svn # list all files or subdirectories marked with an SVN property _get_no_export = $(shell svn propget $(if $(filter %/*,$(1)), noexport $(wildcard $(1)), -R noexport $(1)) | awk '$$3 ~ /$(2)/ { print $$1 }') else _get_no_export := endif # Local Variables: # mode: Makefile # End: