source: PSPA/madxPSPA/make/make.lib @ 447

Last change on this file since 447 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 1.4 KB
Line 
1# |
2# o---------------------------------------------------------------------o
3# |
4# | MAD makefile - utilities
5# |
6# o---------------------------------------------------------------------o
7# |
8# | Methodical Accelerator Design
9# |
10# | Copyright (c) 2011+ CERN, mad@cern.ch
11# |
12# | For more information, see http://cern.ch/mad
13# |
14# o---------------------------------------------------------------------o
15# |
16# | $Id$
17# |
18
19# some useful variables
20EMPTY :=
21SPACE :=
22SPACE +=
23
24# some useful functions
25eq     = $(if $(patsubst $1,,$2),,t)
26neq    = $(if $(patsubst $1,,$2),t,)
27
28escsp  = $(subst $(SPACE),\ ,$1)
29
30first  = $(word 1,$1)
31last   = $(word $(words $1),$1)
32rest   = $(wordlist 2,$(words $1),$1)
33chop   = $(wordlist 2,$(words $1),_ $1)
34uniq   = $(strip $(if $1,$(call uniq,$(call chop,$1)) \
35            $(if $(filter $(call last,$1),$(call chop,$1)),,$(call last,$1))))
36trans  = $(if $1,$(call trans,$(call rest,$1),$(call rest,$2)\
37                    ,$(patsubst $(firstword $1),$(firstword $2),$3)),$3)
38find   = $(if $(and $1,$2),$(if $(findstring $1,$(firstword $2)),$2,\
39              $(call find,$1,$(call rest,$2))),)
40trunc  = $(if $(and $1,$2),$(if $(findstring $1,$(lastword $2)),$2,\
41              $(call trunc,$1,$(call chop,$2))),)
42
43assert = $(if $1,,$(error $2))
44exists = $(if $(wildcard $1),,$(error $2))
45mkdir  = $(if $(wildcard $1),,$(shell mkdir $(if $(windir),,-p) $1))
46
47# end of makefile
Note: See TracBrowser for help on using the repository browser.