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 | CC = nvcc |
---|
23 | CFLAGS = -O2 |
---|
24 | ARCH := $(shell uname -m) |
---|
25 | |
---|
26 | ifeq ($(ARCH), i686) |
---|
27 | CFLAGS += --machine 32 |
---|
28 | endif |
---|
29 | |
---|
30 | ifeq ($(ARCH), x86_64) |
---|
31 | CFLAGS += --machine 64 |
---|
32 | endif |
---|
33 | |
---|
34 | ifeq ($(wildcard /etc/bccd-revision),) # not the BCCD |
---|
35 | TARGETS = device-query device-query-mpi hello-cuda |
---|
36 | LDFLAGS = |
---|
37 | else # the BCCD |
---|
38 | # The combination of MPI and CUDA and icc needs to be reconciled before |
---|
39 | # device-query-mpi can be built, separate functions into CUDA and not |
---|
40 | TARGETS = device-query hello-cuda |
---|
41 | endif |
---|
42 | |
---|
43 | all: $(TARGETS) |
---|
44 | |
---|
45 | device-query : device-query-local.c device-query-functions.h |
---|
46 | $(CC) $(CFLAGS) -o $@ device-query-local.c $(LDFLAGS) |
---|
47 | |
---|
48 | device-query-mpi : device-query-mpi.c device-query-functions.h |
---|
49 | $(CC) $(CFLAGS) --compiler-bindir='mpicc' -o $@ device-query-mpi.c $(LDFLAGS) |
---|
50 | |
---|
51 | hello-cuda : hello-cuda.cu |
---|
52 | $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) |
---|
53 | |
---|
54 | clean : |
---|
55 | rm -f device-query hello-cuda device-query-mpi |
---|