-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
124 lines (107 loc) · 2.95 KB
/
Makefile
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
### Wisecracker: A cryptanalysis framework
### Copyright (c) 2011-2012, Vikas Naresh Kumar, Selective Intellect LLC
###
### This program is free software: you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation, either version 3 of the License, or
### any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################
### COPYRIGHT: 2011-2012 Selective Intellect LLC. All Rights Reserved
### AUTHOR: Vikas Kumar
### DATE: 21st Dec 2011
### SOFTWARE: Wisecracker
#########################################################################
CMAKE=$(shell which cmake)
CTEST=$(shell which ctest)
PREFIX?=/usr/local
ARCH=$(shell uname -m)
OPENCL_ROOT?=/usr
CC=$(shell which gcc)
CXX=$(shell which g++)
MPICC?=$(shell which mpicc)
RELEASE=
ifeq ($(RELEASE),1)
BUILD_TYPE=MinSizeRel
BUILD_DIR=Release_$(ARCH)
else
BUILD_TYPE=Debug
BUILD_DIR=Debug_$(ARCH)
endif
CMAKEBUILDVAR=-DOPENCL_ROOT=$(OPENCL_ROOT) -DARCH=$(ARCH) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_INSTALL_PREFIX=$(PREFIX)
ifneq ($(MPICC),)
CMAKEBUILDVAR+=-DMPI_C_COMPILER=$(MPICC) -DMPI_COMPILER=$(MPICC)
endif
ifeq ($(CMAKE),)
$(error Cannot find cmake. Please install CMake or place it in the path)
endif
default: all
.PHONY: default
all: buildwise
.PHONY: all
rebuild: distclean buildwise
.PHONY: rebuild
release:
$(MAKE) RELEASE=1
.PHONY: release
debug:
$(MAKE) RELEASE=0
.PHONY: debug
distclean: cmakeclean
.PHONY: distclean
clean: cleanwise
.PHONY: clean
test: testwise
.PHONY: test
install:
$(MAKE) installwise RELEASE=1
.PHONY: install
buildwise:
@mkdir -p $(BUILD_DIR); \
cd $(BUILD_DIR); \
export CC=$(CC); \
export CXX=$(CXX); \
$(CMAKE) $(CMAKEBUILDVAR) .. ; \
$(MAKE); \
echo "$(BUILD_TYPE) Build complete"
.PHONY: buildwise
cmakeclean: clean
@if test -d $(BUILD_DIR); then \
cd $(BUILD_DIR); \
rm -rf CMakeCache.txt; \
echo "$(BUILD_TYPE) cmake cleaning complete"; \
else \
echo "Nothing to clean for $(BUILD_TYPE)"; \
fi
.PHONY: cmakeclean
cleanwise:
@if test -d $(BUILD_DIR); then \
cd $(BUILD_DIR); \
$(MAKE) clean; \
echo "$(BUILD_TYPE) cleaning complete"; \
else \
echo "Nothing to clean for $(BUILD_TYPE)"; \
fi
.PHONY: cleanwise
testwise: buildwise
@if test -d $(BUILD_DIR); then \
cd $(BUILD_DIR); \
$(CTEST); \
fi
.PHONY: testwise
installwise: buildwise
@if test -d $(BUILD_DIR); then \
cd $(BUILD_DIR); \
$(MAKE) install; \
echo "$(BUILD_TYPE) installation complete"; \
else \
echo "Nothing to install for $(BUILD_TYPE)"; \
fi
.PHONY: installwise