11ifndef config
22ifneq ("$(wildcard ./config.mk) ","")
3- config = config.mk
3+ config ? = config.mk
44else
5- config = make/config.mk
5+ config ? = make/config.mk
66endif
77endif
88
@@ -19,31 +19,24 @@ SRC = $(wildcard src/*.cc src/*/*.cc src/*/*/*.cc)
1919ALL_OBJ = $(patsubst src/% .cc, build/% .o, $(SRC ) )
2020ALL_DEP = $(ALL_OBJ ) $(LIB_HALIDE_IR )
2121
22- ifneq ($(USE_CUDA_PATH ) , NONE)
23- NVCC=$(USE_CUDA_PATH)/bin/nvcc
24- endif
25-
2622export LDFLAGS = -pthread -lm
27- export CFLAGS = -std=c++11 -Wall -O2\
28- -Iinclude -Idmlc-core/include -IHalideIR/src -fPIC
29- export FRAMEWORKS =
30-
31- ifneq ($(ADD_CFLAGS ) , NONE)
32- CFLAGS += $(ADD_CFLAGS)
33- endif
23+ export CFLAGS = -std=c++11 -Wall -O2 -fno-rtti\
24+ -Iinclude -Idmlc-core/include -IHalideIR/src -fPIC -DDMLC_ENABLE_RTTI=0
3425
35- ifneq ($(ADD_LDFLAGS ) , NONE)
36- LDFLAGS += $(ADD_LDFLAGS)
26+ ifdef CUDA_PATH
27+ NVCC=$(CUDA_PATH)/bin/nvcc
28+ CFLAGS += -I$(CUDA_PATH)/include
29+ LDFLAGS += -L$(CUDA_PATH)/lib64
3730endif
3831
39-
4032ifeq ($(USE_CUDA ) , 1)
4133 CFLAGS += -DTVM_CUDA_RUNTIME=1
4234 LDFLAGS += -lcuda -lcudart -lnvrtc
4335else
4436 CFLAGS += -DTVM_CUDA_RUNTIME=0
4537endif
4638
39+ FRAMEWORKS =
4740
4841ifeq ($(USE_OPENCL ) , 1)
4942 CFLAGS += -DTVM_OPENCL_RUNTIME=1
5750 CFLAGS += -DTVM_OPENCL_RUNTIME=0
5851endif
5952
53+ # llvm configuration
54+ LLVM_CONFIG =llvm-config
55+
56+ ifeq ($(USE_LLVM ) , 1)
57+ LLVM_VERSION=$(shell $(LLVM_CONFIG) --version| cut -b 1,3)
58+ LLVM_INCLUDE=$(filter -I%, $(shell $(LLVM_CONFIG) --cxxflags))
59+ LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags --libs --system-libs)
60+ CFLAGS += $(LLVM_INCLUDE) -DTVM_LLVM_VERSION=$(LLVM_VERSION)
61+ endif
62+
63+ ifdef $(ADD_CFLAGS)
64+ CFLAGS += $(ADD_CFLAGS)
65+ endif
66+
67+ ifdef $(ADD_LDFLAGS)
68+ LDFLAGS += $(ADD_LDFLAGS)
69+ endif
6070
6171include tests/cpp/unittest.mk
6272
0 commit comments