From 15b4bdbe1dfe0a5701869837b203f09080eb08e6 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 30 Dec 2022 11:00:17 -0800 Subject: [PATCH] [script] now make compile should work well. --- Makefile | 22 ++++++++++++++----- .../tutorials/getting_started/compile.rst | 4 ++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7197f4f9e..e9dcb26e9 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ MAKEFLAGS := -s # Directory to build the codes SOURCE_DIR :=${PWD} BUILD_DIR ?= build +CMAKE_GOALS = all # Find CMake command from system variable, otherwise use a default one ifeq ($(origin CMAKE_COMMAND),undefined) @@ -52,20 +53,31 @@ export COMMENT_EXTRACT help: @${PYTHON_EXEC} -c "$$COMMENT_EXTRACT" -.PHONY: all +.PHONY: help checkout: # Update all the submodules git submodule init git submodule update --init --recursive -compile: -# Compile the code base +prebuild: +# Run cmake to generate Makefile under the build directory, before compilation @mkdir -p ${BUILD_DIR} echo "cd ${BUILD_DIR} && ${CMAKE_COMMAND} ${CMAKE_FLAGS} ${SOURCE_DIR}" cd ${BUILD_DIR} && ${CMAKE_COMMAND} ${CMAKE_FLAGS} ${SOURCE_DIR} - echo "Building target(s): ${MAKECMDGOALS}" - @+${MAKE} -C ${BUILD_DIR} ${MAKECMDGOALS} + +compile: prebuild +# Compile the code base. By default, all the targets will be compiled +# Following options are available +# .. option:: CMAKE_GOALS +# +# Define the target for cmake to compile. for example, ``cmake_goals=openfpga`` indicates that only openfpga binary will be compiled + echo "Building target(s): ${CMAKE_GOALS}" + @+${MAKE} -C ${BUILD_DIR} ${CMAKE_GOALS} + +list_cmake_targets: prebuild +# Show the targets available to be built, which can be specified through ``CMAKE_GOALS`` when compile + cd ${BUILD_DIR} && make help && cd - all: checkout compile # A shortcut command to run checkout and compile in serial diff --git a/docs/source/tutorials/getting_started/compile.rst b/docs/source/tutorials/getting_started/compile.rst index d4d089b33..ddd29935c 100644 --- a/docs/source/tutorials/getting_started/compile.rst +++ b/docs/source/tutorials/getting_started/compile.rst @@ -81,6 +81,10 @@ The following options are available for a custom build .. warning:: By default, only required modules in *Verilog-to-Routing* (VTR) is enabled. On other words, ``abc``, ``odin``, ``yosys`` and other add-ons inside VTR are not built. If you want to enable them, please look into the dedicated options of CMake scripts. +.. option:: CMAKE_GOALS= + + Specify the build target for CMake system. For example, ``cmake_goals=openfpga`` indicates that only openfpga binary will be compiled. For a detailed list of targets, use ``make list_cmake_targets`` to show. By default, all the build targets will be included. + .. _tutorial_compile_dependencies: Dependencies