diff options
author | Determinant <[email protected]> | 2015-05-29 23:06:58 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-05-29 23:06:58 +0800 |
commit | 74b9f7cb88cd21cfac3c2e50c8efb802485df0c5 (patch) | |
tree | bd6e583088a086144acc2d8af3eaca59691194ff /tnet_io/tnet.mk |
init
Diffstat (limited to 'tnet_io/tnet.mk')
-rw-r--r-- | tnet_io/tnet.mk | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/tnet_io/tnet.mk b/tnet_io/tnet.mk new file mode 100644 index 0000000..775fe85 --- /dev/null +++ b/tnet_io/tnet.mk @@ -0,0 +1,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 + +# +######################################################### + + |