Lunderberg commented on a change in pull request #8317:
URL: https://github.com/apache/tvm/pull/8317#discussion_r658060824



##########
File path: Makefile
##########
@@ -15,68 +15,80 @@
 # specific language governing permissions and limitations
 # under the License.
 
+
+.PHONY: all \
+        runtime vta cpptest crttest \
+        lint pylint cpplint scalalint \
+       doc \
+       web webclean \
+       cython cython3 cyclean \
+        clean
+
+# Remember the root directory, to be usable by submake invocation.
 ROOTDIR = $(CURDIR)
-# Specify an alternate output directory relative to ROOTDIR. Default build
-OUTPUTDIR = $(if $(OUTDIR), $(OUTDIR), build)
 
-.PHONY: clean all test doc pylint cpplint scalalint lint\
-        cython cython2 cython3 web runtime vta
+# Specify an alternate output directory relative to ROOTDIR.  Defaults
+# to "build".  Can also be a space-separated list of build
+# directories, each with a different configuation.
+TVM_BUILD_PATH ?= build
+TVM_BUILD_PATH := $(abspath $(TVM_BUILD_PATH))
 
-ifndef DMLC_CORE_PATH
-  DMLC_CORE_PATH = $(ROOTDIR)/3rdparty/dmlc-core
-endif
+# Allow environment variables for 3rd-party libraries, default to
+# packaged version.
+DMLC_CORE_PATH ?= $(ROOTDIR)/3rdparty/dmlc-core
+DLPACK_PATH ?= $(ROOTDIR)/3rdparty/dlpack
+VTA_HW_PATH ?= $(ROOTDIR)/3rdparty/vta-hw
 
-ifndef DLPACK_PATH
-  DLPACK_PATH = $(ROOTDIR)/3rdparty/dlpack
-endif
 
-ifndef VTA_HW_PATH
-  VTA_HW_PATH = $(ROOTDIR)/3rdparty/vta-hw
-endif
 
-INCLUDE_FLAGS = -Iinclude -I$(DLPACK_PATH)/include -I$(DMLC_CORE_PATH)/include
-PKG_CFLAGS = -std=c++11 -Wall -O2 $(INCLUDE_FLAGS) -fPIC
-PKG_LDFLAGS =
 
+all: $(addsuffix /all,$(TVM_BUILD_PATH))
 
-all:
-       @mkdir -p $(OUTPUTDIR) && cd $(OUTPUTDIR) && cmake .. && $(MAKE)
+runtime: $(addsuffix /runtime,$(TVM_BUILD_PATH))
+vta: $(addsuffix /vta,$(TVM_BUILD_PATH))
+cpptest: $(addsuffix /cpptest,$(TVM_BUILD_PATH))
+crttest: $(addsuffix /crttest,$(TVM_BUILD_PATH))
 
-runtime:
-       @mkdir -p $(OUTPUTDIR) && cd $(OUTPUTDIR) && cmake .. && $(MAKE) runtime
+# Set up a default config.cmake inside the build directory.
+# filter-out used to avoid circular dependency.
+%/config.cmake: | $(filter-out %/config.cmake,$(ROOTDIR)/cmake/config.cmake)

Review comment:
       True, and testing without the symlink shows that it works correctly.  I 
tend to be hesitant on makefile rules that neither create their target nor are 
marked as `.PHONY`, but it does have the desired behavior here.  We may need 
the symlink at some point in the future, if we want to avoid the call to 
`cmake` when possible, but that can be done at a later point.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to