source: PSPA/madxPSPA/make/make.cfg @ 445

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

import madx-5.01.00

File size: 5.2 KB
Line 
1# |
2# o---------------------------------------------------------------------o
3# |
4# | MAD makefile - config
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# detect operating system
20# OSTYPE = Linux, Darwin, Cygwin, Windows (or empty)
21# OSARCH = i386, i686, x86, x86_64, amd64, ia64 (or empty)
22ifeq ($(windir),)
23OSTYPE := $(shell uname -s)
24OSARCH := $(shell uname -m)
25OSTYPE := $(patsubst CYGWIN%,Cygwin,$(OSTYPE))
26else
27OSTYPE := $(findstring Windows,$(shell ver))
28OSARCH := $(if $(PROCESSOR_ARCHITEW6432),$(PROCESSOR_ARCHITEW6432) \
29                                        ,$(PROCESSOR_ARCHITECTURE))
30endif
31
32# some useful command and variables
33ifeq ($(OSTYPE),Windows)
34/     := $(strip \ )
35LS    := dir /L /B
36CP    := copy /Y
37MV    := move
38RM    := del /f
39RMDIR := rmdir /s /q
40FIND  := find_cmd_not_found
41CAT   := more
42HOME  := $(HOMEDRIVE)$(HOMEPATH)
43else
44/     := /
45LS    := ls -1
46CP    := cp -f
47MV    := mv -f
48RM    := rm -f
49RMDIR := rm -fr
50FIND  := find
51CAT   := cat
52endif
53
54# set command echo (SHOW=yes -> trace commands & remove echo)
55ifneq ($(OSTYPE),Windows)
56_ := $(if $(call eq,$(SHOW),yes),,@)
57E := $(if $(call eq,$(SHOW),yes),@ \#,@ echo)
58else
59_ := $(if $(call eq,$(SHOW),yes),,@)
60E := $(if $(call eq,$(SHOW),yes),@ rem,@ echo)
61endif
62
63# backward slash manip
64ifeq ($(OSTYPE),Windows)
65/   := \$(EMPTY)
66;   := &
67f1bs = $(subst /,\,$1)
68f2bs = $(subst /,\\,$1)
69s1bs = $(subst $(SPACE),\ ,$1)
70else
71/   := /
72;   := ;
73f1bs = $1
74f2bs = $1
75s1bs = $(subst $(SPACE),\ ,$1)
76endif
77
78# detect ARCH if requested
79ifeq ($(ARCH),detect)
80ARCH := $(if $(findstring 64,$(OSARCH)),64,32)
81endif
82
83# detect TESTS if requested or provided
84ifeq ($(TESTS),detect)
85override TESTS := $(notdir $(wildcard tests/test-*))
86endif
87
88# default optimization level
89ifeq ($(NOPT),)
90NOPT := 3
91endif
92
93# destination directory
94ifeq ($(DESTDIR),)
95DESTDIR := build$/
96else
97override DESTDIR := $(subst $/$/,$/,$(strip $(DESTDIR))$/)
98endif
99
100# build directory
101ifeq ($(APPENDLD),yes)
102OBJDIR  = $(DESTDIR)$(OSTYPE)$(ARCH)_$(LDNAME)
103else
104OBJDIR := $(DESTDIR)$(OSTYPE)$(ARCH)
105endif
106
107# project's name
108PRJNAME := $(PROJECT)$(ARCH)
109
110# list of build targets
111BUILDGOALS := $(PROJECT)
112
113# default target (immediate!)
114.DEFAULT_GOAL := $(PROJECT)
115
116# add default target to make commands
117ifeq ($(MAKECMDGOALS),)
118MAKECMDGOALS := $(.DEFAULT_GOAL)
119endif
120
121# shortcut for Intel compilers familly
122ifeq ($(Intel),yes)
123ifeq ($(OSTYPE),Windows)
124CC  := $(if $(CC),icl,)
125CXX := $(if $(CXX),icl,)
126else
127CC  := $(if $(CC),icc,)
128CXX := $(if $(CXX),icc,)
129endif
130FC  := $(if $(FC),ifort,)
131endif
132
133# shortcut for GNU compilers familly
134ifeq ($(GNU),yes)
135CC  := $(if $(CC),gcc,)
136CXX := $(if $(CXX),g++,)
137FC  := $(if $(FC),gfortran,)
138endif
139
140# cleanup default make settings
141ifeq ($(origin CC),default)
142CC :=
143endif
144ifeq ($(origin CXX),default)
145CXX :=
146endif
147ifeq ($(origin FC),default)
148FC :=
149endif
150ifeq ($(origin LD),default)
151LD :=
152endif
153ifeq ($(origin AR),default)
154AR :=
155endif
156ifeq ($(origin ND),default)
157ND :=
158endif
159
160# standard included settings
161ifndef CCNAME
162CCNAME  := $(CC)
163endif
164ifndef CXXNAME
165CXXNAME := $(CXX)
166endif
167ifndef FCNAME
168FCNAME  := $(FC)
169endif
170ifndef LDNAME
171LDNAME  := $(LD)
172endif
173ifndef ARNAME
174ARNAME  := $(AR)
175endif
176ifndef NDNAME
177NDNAME  := $(ND)
178endif
179
180# standard included makefiles
181ifndef FILE_PRE
182FILE_PRE  := Makefile_pre          # user's preprocessing extra stuff
183endif
184ifndef FILE_VER
185FILE_VER  := VERSION               # setup project VERSION and VERSION_DATE
186endif
187ifndef FILE_CPP
188FILE_CPP  := Makefile_cpp          # setup project specific CPPFLAGS defines
189endif
190ifndef FILE_C
191FILE_C    := Makefile_c            # setup project CC_SRC and CC_HDR
192endif
193ifndef FILE_CXX
194FILE_CXX  := Makefile_cxx          # setup project CXX_SRC and CXX_HDR
195endif
196ifndef FILE_F90
197FILE_F90  := Makefile_f90          # setup project FC_SRC
198endif
199ifndef FILE_LIB
200FILE_LIB  := Makefile_lib          # setup project LIBS paths and libs
201endif
202ifndef FILE_SYS
203FILE_SYS  := Makefile_sys          # setup project System specific stuffs
204endif
205ifndef FILE_TEST
206FILE_TEST := Makefile_test         # setup project tests
207endif
208ifndef FILE_POST
209FILE_POST := Makefile_post         # user's postprocessing extra stuff
210endif
211
212# standard translation settings
213CC_tr  = $(strip $1)
214CXX_tr = $(strip $1)
215FC_tr  = $(strip $1)
216LD_tr  = $(strip $1)
217AR_tr  = $(strip $1)
218ND_tr  = $(strip $1)
219
220# standard build defines
221ifeq ($(origin CPPFLAGS),default)
222CPPFLAGS =
223endif
224
225ifeq ($(DEBUG),yes)
226CPPFLAGS += -D_DEBUG
227endif
228
229ifeq ($(PROFILE),yes)
230CPPFLAGS += -D_PROFILE
231endif
232
233ifeq ($(STATIC),yes)
234CPPFLAGS += -D_STATIC
235endif
236
237ifeq ($(SHARED),yes)
238CPPFLAGS += -D_SHARED
239endif
240
241ifeq ($(PLUGIN),yes)
242CPPFLAGS += -D_PLUGIN
243endif
244
245# gnu libs directory (if needed, lazy)
246GNULIBDIR = $(dir $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a))
247
248# clear suffixes (avoid misbehavior)
249.SUFFIXES:
250
251# clear search path (avoid misbehavior)
252VPATH =
253vpath
254
255# end of makefile
Note: See TracBrowser for help on using the repository browser.