[script] now make compile should work well.

This commit is contained in:
tangxifan 2022-12-30 11:00:17 -08:00
parent f3ec7927be
commit 15b4bdbe1d
2 changed files with 21 additions and 5 deletions

View File

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

View File

@ -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=<string>
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