summaryrefslogtreecommitdiff
path: root/tnet_io/tnet.mk
blob: 775fe852cb1a9bdf56e0830af7c36aeda7971005 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
# This makefile contains some global definitions,
# that are used during the build process.
# It is included by all the subridrectory libraries.
#


##############################################################
##### 64-BIT CROSS-COMPILATION #####
CXXFLAGS=
FWDPARAM=
BITS64=true
ifeq ($(BITS64), true)
  ##### CHANGE WHEN DIFFERENT 64BIT g++ PREFIX ##### 
  CROSS_COMPILE = x86_64-linux-
  ##### CHANGE WHEN DIFFERENT 64BIT g++ PREFIX ##### 
  CXXFLAGS += -m64
  FWDPARAM += BITS64=true
else
  CXXFLAGS += -m32
endif

# disable cross-compile prefix if CXX not exists
CXX=$(CROSS_COMPILE)g++
CXX2=$(notdir $(shell which $(CXX) 2>/dev/null))
ifneq ("$(CXX)", "$(CXX2)")
  CROSS_COMPILE=
endif

# compilation tools
CC = $(CROSS_COMPILE)g++
CXX = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
AS = $(CROSS_COMPILE)as




##############################################################
##### PATH TO CUDA TOOLKIT #####
#CUDA_TK_BASE=/usr/local/share/cuda-3.2.12
CUDA_TK_BASE=/usr/local/cuda
##### PATH TO CUDA TOOLKIT #####




# compilation args
CXXFLAGS += -g -Wall -O2 -DHAVE_ATLAS -rdynamic
CXXFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion

# enable double-precision
ifeq ($(DOUBLEPRECISION), true)
  CXXFLAGS += -DDOUBLEPRECISION
  FWDPARAM += DOUBLEPRECISION=true
endif


# compile all the source .cc files 
SRC=$(wildcard *.cc)
OBJ=$(addprefix $(OBJ_DIR)/,$(patsubst %.cc, %.o, $(SRC)))




#########################################################
# CONFIGURATION CHECKS
#

#check that CUDA_TK_BASE is set correctly
ifeq ("$(wildcard $(CUDA_TK_BASE)/bin/nvcc)", "$(CUDA_TK_BASE)/bin/nvcc")
  HAVE_CUDA=true
else 
  ifeq ($(CUDA), true)
    $(error %%% CUDA not found! Incorrect path in CUDA_TK_BASE: $(CUDA_TK_BASE) in 'trunk/src/tnet.mk')
  endif
endif

#
#########################################################