-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
Makefile.common
105 lines (87 loc) · 2.76 KB
/
Makefile.common
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
# Copyright 2018 The DNNC Authors. All Rights Reserved.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=invalid-name, unused-argument
#
# This file is part of DNN compiler maintained at
# https://github.com/ai-techsystems/dnnCompiler
#
UNAME_M := $(shell uname -m)
PYTHON=$(shell which python3)
ifeq (, $(PYTHON) )
$(error "python3 not found in $(PATH)")
endif
CLANG=$(shell which clang++)
ifeq ($(CLANG), )
CC=g++
else
MIN_CLANG_VERSION = "8"
CLANG_VERSION := $(shell clang++ -dumpversion)
IS_CLANG_ABOVE_MIN_VERSION := $(shell expr "$(CLANG_VERSION)" ">=" "$(MIN_CLANG_VERSION)")
ifeq "$(IS_CLANG_ABOVE_MIN_VERSION)" "1"
CC=/usr/bin/clang++
else
CC=/usr/bin/clang++-8
endif
endif
LD=$(shell which ld)
SWIG=$(shell which swig)
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
EIGEN_INCLUDES=-isystem $(ROOT_DIR)/packages/eigen-eigen-323c052e1731
DNNC_INCLUDES= -I$(ROOT_DIR)/include
PY_INCLUDES= -I$(shell python3 -c "from sysconfig import get_paths as gp; print(gp()['include'])")
LD_FLAGS=-shared
CPP_FLAGS=-O3 -Wall -std=c++17 -fPIC -march=native
ifeq ($(UNAME_M), x86_64)
CPP_FLAGS+=-msse2
endif
ifeq ($(UNAME_M), aarch64)
CPP_FLAGS=-O3 -Wall -std=c++17 -fPIC -msse2
endif
ifeq ($(filter arm%,$(UNAME_M)),)
CPP_FLAGS+=-D ARM
endif
SWIG_FLAGS=-python -c++ -Wall
API_GENERATOR=./op_gen.py
BASIC_TEST=../test/swig/basic.py
ifneq (,$(findstring $(FAST_SWIG),yY))
SWIG_FLAGS=-python -c++ -Wall -builtin
endif
ifneq (,$(findstring $(DEV),yY))
API_GENERATOR=./op_gen.py -dev
BASIC_TEST=../test/swig/basic.py -dev
endif
OBJ_DIR=./obj
LIB_DIR=./lib
CORE_OBJ=$(ROOT_DIR)/src/core/obj
#LOG_OBJ=$(ROOT_DIR)/src/spdlog/obj
CODE_OBJ=$(ROOT_DIR)/src/codegen/obj
GRPH_OBJ=$(ROOT_DIR)/src/graph/obj
OPER_OBJ=$(ROOT_DIR)/src/operators/obj
MKDIR_P=mkdir -p
LN_S=ln -s
RM_F=rm -rf
ifneq (,$(findstring $(DEBUG),yY))
CPP_FLAGS=-Wall -std=c++17 -fPIC -g
endif
ifneq (,$(findstring $(LMCHECK),yY))
CPP_FLAGS=-Wall -std=c++17 -fPIC -D_DEBUG -g -lmcheck
endif
ifneq (,$(findstring $(PROF),yY))
CPP_FLAGS=-pg -g -Wall -std=c++17 -fPIC
endif