source: /cluster/svnroot/bccd-ng/tags/bccd-3.3.0-rc-skylar/packages/etc/skel/Makefile @ 4348

Last change on this file since 4348 was 4348, checked in by skylar, 7 years ago

let's see if this works

File size: 6.6 KB
Line 
1# $\Id$
2#
3# This file is part of BCCD, an open-source live CD for computational science
4# education.
5#
6# Copyright (C) 2010 Andrew Fitz Gibbon, Paul Gray, Kevin Hunter, Dave Joiner,
7#   Sam Leeman-Munk, Tom Murphy, Charlie Peck, Skylar Thompson, & Aaron Weeden
8
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22###############################################################################
23# Makefile for the modules included in ~bccd on the BCCD (http://bccd.net)
24#
25# Add NO_X11=1 to the make command line to omit X libraries.
26# Add DEBUG=1 to add -ggdb to CFLAGS
27# Add PROFILE=1 to add -pg to CFLAGS and LDFLAGS
28# Add STAT_KIT=1 to enable StatKit
29###############################################################################
30
31# Test for Intel compilers, act accordingly
32ifeq ($(findstring intel,$(LOADEDMODULES)),intel)
33        CC = icc
34        OMPFLAGS = -openmp -DOMP
35else
36        CC = gcc
37        OMPFLAGS = -fopenmp -DOMP
38endif
39
40MPICC = mpicc
41MPICXX = mpicxx
42NVCC = nvcc
43
44CFLAGS = -O2
45NVCCFLAGS = --compiler-bindir=gcc
46NVMPICCFLAGS = --compiler-bindir=mpicc
47MPIFLAGS = -D_MPI
48
49ifdef STAT_KIT
50        EXTRA_COBJS += ../StatKit/petakit/pkit-c.o
51        EXTRA_CXXOBJS += ../StatKit/petakit/pkit-cxx.o
52        CFLAGS += -DSTAT_KIT
53endif
54
55ifdef NO_X11
56        CFLAGS += -DNO_X11
57else
58        LIBS += -lX11
59        LDFLAGS += -L/usr/X11R6/lib
60endif
61
62ifdef DEBUG
63        CFLAGS += -ggdb
64endif
65
66ifdef PROFILE
67        CFLAGS += -pg
68        LDFLAGS += -pg
69endif
70
71# For Modules using Atlas
72ifeq ($(ATLAS), 1)
73        ifeq ($(wildcard /etc/bccd-revision),)   # not the BCCD
74                CFLAGS += -I/mounts/al-salam/software/atlas-3.9.24/include
75                LDFLAGS += -L/mounts/al-salam/software/atlas-3.9.24/lib
76                LIBS += -latlas -lcblas
77        else                                     # the BCCD
78                # this is a placeholder until we build ATLAS into a module
79                # CFLAGS +=
80                # LDFLAGS +=
81                # LIBS +=
82        endif
83endif
84
85#For Modules using FFTW (version 3.3)
86ifeq ($(FFTW), 1)
87        ifeq ($(wildcard /etc/bccd-revision),)   # not the BCCD
88                CFLAGS += -I/mounts/al-salam/software/fftw-3.3/include
89                LDFLAGS += -L/mounts/al-salam/software/fftw-3.3/lib
90                LIBS += -lfftw3f
91        else                                     # the BCCD
92                # this is a placeholder until we build FFTW into a module
93                # FLAGS +=
94                # LDFLAGS +=
95                # LIBS +=
96        endif
97endif
98
99# For Modules using NetCDF
100ifeq ($(NETCDF), 1)
101        ifeq ($(wildcard /etc/bccd-revision),) # Not the BCCD
102                CFLAGS += -I$(NETCDF_INCLUDE)/ -DHAS_NETCDF
103                LDFLAGS += -L$(NETCDF_PATH)/
104                LIBS += -lnetcdf
105        else
106                # this is a placeholder until we build NETCDF into a module
107                # CFLAGS +=
108                # LDFLAGS +=
109                # LIBS +=
110        endif
111endif
112
113# For Modules using Gadget2
114ifeq ($(GADGET2), 1)
115        ifeq ($(wildcard /etc/bccd-revision),) # Not the BCCD
116                CFLAGS += -I/share/apps/hdf5/gnu/include/ -DHAS_HDF5
117                LDFLAGS += -L/share/apps/hdf5/gnu/lib/
118                LIBS += -lhdf5 -lhdf5_hl
119        else
120                # This is a placeholder until we build Gadget2 into a module
121                # CFLAGS +=
122                # LDFLAGS +=
123                # LIBS +=
124        endif
125endif
126
127# For Modules using LIBGD
128ifeq    ($(LIBGD), 1)
129        ifeq    ($(wildcard /etc/bccd-revision),) # Not the BCCD
130                CFLAGS += -DHAS_LIBGD
131                LIBS += -ljpeg -lpng -lz -lgd
132        else
133                # This is a placeholder until we build LibGD into a module
134                # CFLAGS +=
135                # LDFLAGS +=
136                # LIBS +=
137        endif
138endif
139
140# For modules using CUBLAS
141ifeq ($(CUBLAS), 1)
142        LIBS += -lcublas
143endif
144
145LIBS += -lm
146LDFLAGS += $(LIBS)
147       
148$(PROGRAM).c-serial:
149        $(CC) $(CSRCS) $(EXTRA_COBJS) $(CFLAGS) $(LDFLAGS) -o $@
150
151$(PROGRAM).c-mpi:
152        $(MPICC) $(CPPFLAGS) $(CSRCS) $(EXTRA_COBJS) $(CFLAGS) $(MPIFLAGS) $(LDFLAGS) -o $@
153
154$(PROGRAM).cxx-mpi:
155        $(MPICXX) $(CPPFLAGS) $(CXXSRCS) $(EXTRA_CXXOBJS) $(CFLAGS) $(MPIFLAGS) $(LDFLAGS) -o $@
156
157$(PROGRAM).c-openmp:
158        $(CC) $(CSRCS) $(EXTRA_COBJS) $(CFLAGS) $(OMPFLAGS) $(LDFLAGS) -o $@
159
160$(PROGRAM).c-mpi-openmp:
161        $(MPICC) $(CPPFLAGS) $(CSRCS) $(EXTRA_COBJS) $(CFLAGS) $(OMPFLAGS) $(MPIFLAGS) $(LDFLAGS) -o $@
162
163$(PROGRAM).c-cuda:
164        $(NVCC) $(CUDASRCS) $(EXTRA_COBJS) $(CFLAGS) $(NVCCFLAGS) $(LDFLAGS) -o $@
165
166help:
167        @echo "This is the driver Makefile for all the modules shipped in ~bccd."
168        @echo "The following commands are supported:"
169        @echo "  $ make build-all (to build all modules)"
170        @echo "  $ make clean-all (to clean all modules)"
171        @echo "The following options are supported by most modules:"
172        @echo "  NO_X11=1 (do not include an X11 GUI component)"
173        @echo "  DEBUG=1 (adds -ggdb to CFLAGS)"
174        @echo "  PROFILE=1 (adds -pg to CFLAGS and LDFLAGS)"
175        @echo "  STAT_KIT=1 (enables the StatKit performance collector tool)"
176        @echo "You can also cd to a module's directory and type make (options optional)."
177
178build-all:
179        @echo "-------------------------------------"
180        cd CUDA; $(MAKE)
181        @echo "-------------------------------------"
182        cd Life; $(MAKE)
183        @echo "-------------------------------------"
184        cd GalaxSee; $(MAKE)
185        @echo "-------------------------------------"
186        cd Hello-world; $(MAKE)
187        @echo "-------------------------------------"
188        cd Parameter-space; $(MAKE)
189        @echo "-------------------------------------"
190        cd GalaxSee-v2; $(MAKE)
191        @echo "-------------------------------------"
192        cd Area-under-curve; $(MAKE)
193        @echo "-------------------------------------"
194        cd Pandemic; $(MAKE)
195        @echo "-------------------------------------"
196        cd Sieve; $(MAKE)
197        @echo "-------------------------------------"
198        cd Tree-sort; $(MAKE)
199        @echo "-------------------------------------"
200
201clean-all:
202        @echo "-------------------------------------"
203        cd CUDA; $(MAKE) clean
204        @echo "-------------------------------------"
205        cd Life; $(MAKE) clean
206        @echo "-------------------------------------"
207        cd GalaxSee; $(MAKE) clean
208        @echo "-------------------------------------"
209        cd Hello-world; $(MAKE) clean
210        @echo "-------------------------------------"
211        cd Parameter-space; $(MAKE) clean
212        @echo "-------------------------------------"
213        cd GalaxSee-v2; $(MAKE) clean
214        @echo "-------------------------------------"
215        cd Area-under-curve; $(MAKE) clean
216        @echo "-------------------------------------"
217        cd Pandemic; $(MAKE) clean
218        @echo "-------------------------------------"
219        cd Sieve; $(MAKE) clean
220        @echo "-------------------------------------"
221        cd Tree-sort; $(MAKE) clean
222        @echo "-------------------------------------"
223        cd StatKit/petakit; $(MAKE) clean
224        @echo "-------------------------------------"
225       
226clean:
227        /bin/rm -f $(CLEAN)
Note: See TracBrowser for help on using the repository browser.