Skip to content

Commit 74ce3b8

Browse files
anchaoxiaoxiang781216
authored andcommitted
build/Kconfig: add BINDIR/APPSBINDIR to support out of tree build
First decoupling changes related to CMAKE BINDIR/APPSBINDIR: Output path of Kconfig which dynamically generated by NuttX Kernel/Apps This option is consistent with the TOPDIR/APPSDIR by default, and will be changed when out-of-tree compilation is supported Signed-off-by: chao an <anchao@xiaomi.com>
1 parent 2d53605 commit 74ce3b8

File tree

7 files changed

+44
-20
lines changed

7 files changed

+44
-20
lines changed

Kconfig

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ config APPSDIR
99
string
1010
option env="APPSDIR"
1111

12+
config APPSBINDIR
13+
string
14+
option env="APPSBINDIR"
15+
---help---
16+
Output path of Kconfig which dynamically generated by NuttX Apps
17+
This option is consistent with the APPSDIR by default, and will
18+
be changed when out-of-tree compilation is supported
19+
20+
config BINDIR
21+
string
22+
option env="BINDIR"
23+
---help---
24+
Output path of Kconfig which dynamically generated by NuttX Kernel
25+
This option is consistent with the TOPDIR by default, and will
26+
be changed when out-of-tree compilation is supported
27+
1228
menu "License Setup"
1329
config ALLOW_BSD_COMPONENTS
1430
bool "Use components that have BSD licenses"
@@ -2124,7 +2140,7 @@ source "openamp/Kconfig"
21242140
endmenu
21252141

21262142
menu "Application Configuration"
2127-
source "$APPSDIR/Kconfig"
2143+
source "$APPSBINDIR/Kconfig"
21282144
endmenu
21292145

21302146
# Support optionally including external code

arch/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ config ARCH_CHIP_CUSTOM_DIR_RELPATH
229229
endmenu # Custom Chip Configuration
230230
endif #ARCH_CHIP_CUSTOM
231231

232-
source "arch/dummy/Kconfig"
232+
source "$BINDIR/arch/dummy/Kconfig"
233233

234234
config ARCH_TOOLCHAIN_IAR
235235
bool

boards/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3641,7 +3641,7 @@ if ARCH_BOARD_MOTEINO_MEGA
36413641
source "boards/avr/atmega/moteino-mega/Kconfig"
36423642
endif
36433643
if ARCH_BOARD_CUSTOM
3644-
source "boards/dummy/Kconfig"
3644+
source "$BINDIR/boards/dummy/Kconfig"
36453645
endif
36463646
if ARCH_BOARD_DEMOS92S12NEC64
36473647
source "boards/hc/m9s12/demo9s12ne64/Kconfig"

boards/arm/cxd56xx/drivers/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#
55

66
if SPECIFIC_DRIVERS
7-
source "drivers/platform/audio/Kconfig"
8-
source "drivers/platform/sensors/Kconfig"
7+
source "$BINDIR/drivers/platform/audio/Kconfig"
8+
source "$BINDIR/drivers/platform/sensors/Kconfig"
99
endif

drivers/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ source "drivers/wireless/Kconfig"
4646
source "drivers/contactless/Kconfig"
4747
source "drivers/1wire/Kconfig"
4848
source "drivers/syslog/Kconfig"
49-
source "drivers/platform/Kconfig"
49+
source "$BINDIR/drivers/platform/Kconfig"
5050
source "drivers/rf/Kconfig"
5151
source "drivers/rc/Kconfig"
5252
source "drivers/motor/Kconfig"

tools/Unix.mk

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -602,43 +602,46 @@ pass2dep: context tools/mkdeps$(HOSTEXEEXT) tools/cnvwindeps$(HOSTEXEEXT)
602602
# location: https://bitbucket.org/nuttx/tools/downloads/. See README.txt
603603
# file in the NuttX tools GIT repository for additional information.
604604

605+
KCONFIG_ENV = APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR)
606+
KCONFIG_ENV += APPSBINDIR=${CONFIG_APPS_DIR} BINDIR=${TOPDIR}
607+
605608
config:
606609
$(Q) $(MAKE) clean_context
607610
$(Q) $(MAKE) apps_preconfig
608-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf Kconfig
611+
$(Q) ${KCONFIG_ENV} kconfig-conf Kconfig
609612

610613
oldconfig:
611614
$(Q) $(MAKE) clean_context
612615
$(Q) $(MAKE) apps_preconfig
613-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --oldconfig Kconfig
616+
$(Q) ${KCONFIG_ENV} kconfig-conf --oldconfig Kconfig
614617

615618
olddefconfig:
616619
$(Q) $(MAKE) clean_context
617620
$(Q) $(MAKE) apps_preconfig
618-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --olddefconfig Kconfig
621+
$(Q) ${KCONFIG_ENV} kconfig-conf --olddefconfig Kconfig
619622

620623
menuconfig:
621624
$(Q) $(MAKE) clean_context
622625
$(Q) $(MAKE) apps_preconfig
623-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-mconf Kconfig
626+
$(Q) ${KCONFIG_ENV} kconfig-mconf Kconfig
624627

625628
nconfig: apps_preconfig
626629
$(Q) $(MAKE) clean_context
627630
$(Q) $(MAKE) apps_preconfig
628-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-nconf Kconfig
631+
$(Q) ${KCONFIG_ENV} kconfig-nconf Kconfig
629632

630633
qconfig: apps_preconfig
631634
$(Q) $(MAKE) clean_context
632635
$(Q) $(MAKE) apps_preconfig
633-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-qconf Kconfig
636+
$(Q) ${KCONFIG_ENV} kconfig-qconf Kconfig
634637

635638
gconfig: apps_preconfig
636639
$(Q) $(MAKE) clean_context
637640
$(Q) $(MAKE) apps_preconfig
638-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-gconf Kconfig
641+
$(Q) ${KCONFIG_ENV} kconfig-gconf Kconfig
639642

640643
savedefconfig: apps_preconfig
641-
$(Q) APPSDIR=${CONFIG_APPS_DIR} EXTERNALDIR=$(EXTERNALDIR) kconfig-conf --savedefconfig defconfig.tmp Kconfig
644+
$(Q) ${KCONFIG_ENV} kconfig-conf --savedefconfig defconfig.tmp Kconfig
642645
$(Q) kconfig-tweak --file defconfig.tmp -u CONFIG_APPS_DIR
643646
$(Q) grep "CONFIG_ARCH=" .config >> defconfig.tmp
644647
$(Q) grep "^CONFIG_ARCH_CHIP_" .config >> defconfig.tmp; true

tools/Win.mk

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,33 +571,38 @@ pass2dep: context tools\mkdeps$(HOSTEXEEXT)
571571
# location: https://bitbucket.org/nuttx/tools/downloads/. See
572572
# misc\tools\README.txt for additional information.
573573

574+
KCONFIG_ENV = set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR}) & \
575+
set EXTERNALDIR=$(EXTERNALDIR) & \
576+
set APPSBINDIR=$(patsubst "%",%,${CONFIG_APPS_DIR}) & \
577+
set BINDIR=$(patsubst "%",%,${TOPDIR}) &
578+
574579
config:
575580
$(Q) $(MAKE) clean_context
576581
$(Q) $(MAKE) apps_preconfig
577-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-conf Kconfig
582+
$(Q) $(KCONFIG_ENV) kconfig-conf Kconfig
578583

579584
oldconfig:
580585
$(Q) $(MAKE) clean_context
581586
$(Q) $(MAKE) apps_preconfig
582-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-conf --oldconfig Kconfig
587+
$(Q) ${KCONFIG_ENV} kconfig-conf --oldconfig Kconfig
583588

584589
olddefconfig:
585590
$(Q) $(MAKE) clean_context
586591
$(Q) $(MAKE) apps_preconfig
587-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-conf --olddefconfig Kconfig
592+
$(Q) ${KCONFIG_ENV} kconfig-conf --olddefconfig Kconfig
588593

589594
menuconfig:
590595
$(Q) $(MAKE) clean_context
591596
$(Q) $(MAKE) apps_preconfig
592-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-mconf Kconfig
597+
$(Q) ${KCONFIG_ENV} kconfig-mconf Kconfig
593598

594599
nconfig:
595600
$(Q) $(MAKE) clean_context
596601
$(Q) $(MAKE) apps_preconfig
597-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-nconf Kconfig
602+
$(Q) ${KCONFIG_ENV} kconfig-nconf Kconfig
598603

599604
savedefconfig: apps_preconfig
600-
$(Q) set APPSDIR=$(patsubst "%",%,${CONFIG_APPS_DIR})& set EXTERNALDIR=$(EXTERNALDIR)& kconfig-conf --savedefconfig defconfig.tmp Kconfig
605+
$(Q) ${KCONFIG_ENV} kconfig-conf --savedefconfig defconfig.tmp Kconfig
601606
$(Q) kconfig-tweak --file defconfig.tmp -u CONFIG_APPS_DIR
602607
$(Q) grep "CONFIG_ARCH=" .config >> defconfig.tmp
603608
-$(Q) grep "^CONFIG_ARCH_CHIP_" .config >> defconfig.tmp

0 commit comments

Comments
 (0)