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



##########
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:
       Good point, I had been going off of the "Install from Source" 
documentation, and hadn't realized there could be a root directory config.cmake 
instead.  I'd like to have the `%/config.cmake` build rule in place so that it 
can later be specialized to set up local build directories to match the CI.  
(e.g. The rule for `build_docker/ci_gpu/config.cmake` would copy `config.cmake` 
to that location, then run `tests/scripts/task_config_build_gpu.sh` on it.)
   
   I think the best way to maintain the current behavior while allowing for 
this later expansion would be to symlink to a root directory `config.cmake` if 
it exists, falling back to copying the `config.cmake` if it doesn't.




-- 
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