Skip to content

Commit 15c7fce

Browse files
hovindoharboe
authored andcommitted
makefile: SUB_MAKE fix
Make OpenROAD-flow-scripts `Makefile` work when invoked with `make --file=$FLOW_DIR/Makefile` and `make --directory $FLOW_DIR` Co-authored-by: Øyvind Harboe <[email protected]> Signed-off-by: Øyvind Harboe <[email protected]>
1 parent b8cd70a commit 15c7fce

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

flow/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,13 @@ endif
549549

550550
UNSET_VARS = for var in $(UNSET_VARIABLES_NAMES); do unset $$var; done
551551

552-
SUB_MAKE = $(MAKE) $(foreach V,$(COMMAND_LINE_ARGS), $(if $($V),$V=$(shell echo "$($V)" | $(FLOW_HOME)/scripts/escape.sh),$V='')) --no-print-directory DESIGN_CONFIG=$(DESIGN_CONFIG)
552+
# FILE_MAKEFILE is needed when ORFS is invoked with
553+
# `make --file=$FLOW_DIR/Makefile` or `make --directory $FLOW_DIR`.
554+
#
555+
# However, on some versions of make, MAKEFILE_LIST can be empty, so
556+
# don't expand it in that case.
557+
FILE_MAKEFILE ?= $(if $(firstword $(MAKEFILE_LIST)),--file=$(firstword $(MAKEFILE_LIST)),)
558+
SUB_MAKE = $(MAKE) $(foreach V,$(COMMAND_LINE_ARGS), $(if $($V),$V=$(shell echo "$($V)" | $(FLOW_HOME)/scripts/escape.sh),$V='')) --no-print-directory $(FILE_MAKEFILE) DESIGN_CONFIG=$(DESIGN_CONFIG)
553559
UNSET_AND_MAKE = @bash -c '$(UNSET_VARS); $(SUB_MAKE) $$@' --
554560

555561
$(OBJECTS_DIR)/copyright.txt:

0 commit comments

Comments
 (0)