1 | # | |
---|
2 | # o---------------------------------------------------------------------o |
---|
3 | # | |
---|
4 | # | MAD makefile - documentation |
---|
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 | The MAD-X makefile is intended to compile project using C, C++ and Fortran 90 |
---|
20 | compilers in a flexible way. The following sections explain how to configure |
---|
21 | the makefile for the project. Changing the value of a variable on the command |
---|
22 | line of make allows to setup different configuration for your project, including |
---|
23 | the user-defined files included for files selection (see Includes settings). |
---|
24 | |
---|
25 | targets for building the project: |
---|
26 | [none] | $(PROJECT)$(ARCH)$(PROJEXT) |
---|
27 | |
---|
28 | targets for printing information: |
---|
29 | info | infoinc | infoprj | infoall |
---|
30 | |
---|
31 | targets for cleaning generated files: |
---|
32 | clean | cleandir | cleanc | cleancxx | cleanf90 | cleanbuild | cleanall |
---|
33 | |
---|
34 | makefile options: |
---|
35 | - SHOW=yes displays commands executed by make instead of summary message |
---|
36 | |
---|
37 | ################### |
---|
38 | # Project settings |
---|
39 | |
---|
40 | PROJECT sets the project name. |
---|
41 | The program/library/archive will have the name $(PROJECT)$(ARCH)$(PROJEXT) |
---|
42 | |
---|
43 | Other flags can be added to configure the project. |
---|
44 | Logical flags should use yes/no, not YES/NO |
---|
45 | |
---|
46 | ################# |
---|
47 | # Build settings |
---|
48 | |
---|
49 | In the following settings, the first option is the default. |
---|
50 | |
---|
51 | ARCH=detect/32/64 sets the target platform archictecture |
---|
52 | 'detect' is replaced by 32/64 depending on platform architecture |
---|
53 | The default target will have the name $(PROJECT)$(ARCH) |
---|
54 | The program/library/archive will have the name $(PROJECT)$(ARCH)$(PROJEXT) |
---|
55 | |
---|
56 | DEBUG=yes/no sets/unsets the build for debugging (with dwarf-2 compliance) |
---|
57 | adds -D_DEBUG to CPPFLAGS |
---|
58 | |
---|
59 | PROFILE=yes/no sets/unsets the build for profiling (with gprof compliance) |
---|
60 | adds -D_PROFILE to CPPFLAGS |
---|
61 | |
---|
62 | STATIC=no/yes unsets/sets the build for static linking (for distribution) |
---|
63 | |
---|
64 | PLUGIN=no/yes unsets/sets the build for dynamic loading of plugins |
---|
65 | adds -D_PLUGIN to CPPFLAGS |
---|
66 | |
---|
67 | ################################### |
---|
68 | # Compilers/Linkers/Tester settings |
---|
69 | |
---|
70 | CC=gcc sets the name of the C compiler. |
---|
71 | The settings of the compiler are included from the file make/compiler.$(CC) |
---|
72 | |
---|
73 | CXX=g++ sets the name of the C++ compiler. |
---|
74 | The settings of the compiler are included from the file make/compiler.$(CXX) |
---|
75 | |
---|
76 | FC=gfortran sets the name of the F90 compiler. |
---|
77 | The settings of the compiler are included from the file make/compiler.$(FC) |
---|
78 | |
---|
79 | LD=ld sets the name of the linker |
---|
80 | The settings of the linker are included from the file make/linker.$(LD) |
---|
81 | |
---|
82 | ND=numdiff sets the name of the tester |
---|
83 | The settings of the tester are included from the file make/tester.$(ND) |
---|
84 | |
---|
85 | Notes: |
---|
86 | - The compiler, linker and tester configuration files are loaded using |
---|
87 | $(makedir)/compiler.$([CC|CXX|FC]NAME) |
---|
88 | $(makedir)/linker.$(LDNAME) |
---|
89 | $(makedir)/tester.$(NDNAME) |
---|
90 | where $([CC|CXX|FC|LD|ND]NAME) are set to $([CC|CXX|FC|LD|ND]) by default. |
---|
91 | - In order to get the list of supported compilers, linkers and testers, do |
---|
92 | ls -l $(makedir)/compiler.* |
---|
93 | ls -l $(makedir)/linker.* |
---|
94 | ls -l $(makedir)/tester.* |
---|
95 | where usually $(makedir)=make. |
---|
96 | - Example: |
---|
97 | make FC=gfortran44 FCNAME=gfortran |
---|
98 | sets the compiler to gfortran44 but uses the configuration of gfortran |
---|
99 | |
---|
100 | #################### |
---|
101 | # Includes settings |
---|
102 | |
---|
103 | Makefile of the project to include (in this order, all are optional) |
---|
104 | FILE_PRE contains user's preprocessing extra stuffs |
---|
105 | FILE_VER contains the project VERSION and VERSION_DATE that must updated |
---|
106 | FILE_CPP contains extra CPPFLAGS define (-Dname[=value]) |
---|
107 | FILE_C contains C files selection and sets CC_SRC and CC_HDR |
---|
108 | FILE_CXX contains C++ files selection and sets CXX_SRC and CXX_HDR |
---|
109 | FILE_F90 contains F90 files selection and sets FC_SRC |
---|
110 | FILE_LIB sets LIBS with required paths (i.e. -Lpath) and names (i.e. -llib) |
---|
111 | FILE_SYS contains system specific stuff (e.g. unsupported configurations) |
---|
112 | FILE_TEST contains project tests |
---|
113 | FILE_POST contains user's postprocessing extra stuffs (e.g. special rules) |
---|
114 | |
---|
115 | Notes: |
---|
116 | - dependencies of C and C++ files are computed automatically if possible |
---|
117 | - dependencies of F90 are computed automatically if possible (often not) |
---|
118 | - dependencies should be provided if resp. CDEP, CXXDEP, FCDEP are empty |
---|
119 | |
---|
120 | #################### |
---|
121 | # Platform settings |
---|
122 | |
---|
123 | OSTYPE is set to the operating system name |
---|
124 | One of Linux, Darwin, Cygwin, Windows |
---|
125 | |
---|
126 | OSARCH is set to the operating system architecture |
---|
127 | One of i386, i686, x86, x86_64, amd64, ia64 |
---|
128 | |
---|
129 | OBJDIR is set to $(OSTYPE)$(ARCH) |
---|
130 | This is where the files generated by the build (e.g. .o, .d, .mod) are put |
---|
131 | If APPENDLD=yes, then OBJDIR is set to $(OSTYPE)$(ARCH)_$(LDNAME) |
---|
132 | |
---|
133 | NOBUILD is a list of patterns specifying make target which do not make the build. |
---|
134 | It is used to avoid automatic dependencies computation triggered by including |
---|
135 | the .d files (i.e. rules for files dependencies) when they are not required. |
---|
136 | |
---|
137 | #################### |
---|
138 | # Tests settings |
---|
139 | |
---|
140 | TESTS is set to the list of test directories |
---|
141 | tests must be present in the tests subdirectory and prefixed by test- |
---|
142 | |
---|