Makefile 1.08 KB
Newer Older
tqchen committed
1 2
export LDFLAGS = -pthread -lm
export CFLAGS =  -std=c++11 -Wall -O2  -Wno-unknown-pragmas -funroll-loops\
3
	 -Iinclude -Idmlc-core/include -IHalideIR/src  -fPIC
tqchen committed
4 5

# specify tensor path
6
.PHONY: clean all test doc
tqchen committed
7

tqchen committed
8
all: lib/libtvm.a lib/libtvm.so
9 10 11

LIB_HALIDE_IR = HalideIR/lib/libHalideIR.a

tqchen committed
12 13
SRC = $(wildcard src/*.cc src/*/*.cc)
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC))
14
ALL_DEP = $(ALL_OBJ) $(LIB_HALIDE_IR)
tqchen committed
15

tqchen committed
16 17 18 19
include tests/cpp/unittest.mk

test: $(TEST)

tqchen committed
20 21 22 23 24 25 26 27 28 29
build/%.o: src/%.cc
	@mkdir -p $(@D)
	$(CXX) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d
	$(CXX) -c $(CFLAGS) -c $< -o $@


lib/libtvm.a: $(ALL_DEP)
	@mkdir -p $(@D)
	ar crv $@ $(filter %.o, $?)

tqchen committed
30 31 32 33
lib/libtvm.so: $(ALL_DEP)
	@mkdir -p $(@D)
	$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o %.a, $^) $(LDFLAGS)

34 35 36 37 38
$(LIB_HALIDE_IR): LIBHALIDEIR

LIBHALIDEIR:
	+ cd HalideIR; make lib/libHalideIR.a ; cd $(ROOTDIR)

tqchen committed
39 40 41
lint:
	python2 dmlc-core/scripts/lint.py tvm cpp include src

42 43 44
doc:
	doxygen docs/Doxyfile

tqchen committed
45
clean:
tqchen committed
46
	$(RM) -rf build lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o */*.d */*/*.d */*/*/*.d
tqchen committed
47 48 49

-include build/*.d
-include build/*/*.d