@@ -162,6 +162,7 @@ all: $(BIN)
162
162
.PHONY : context clean_context config oldconfig menuconfig nconfig qconfig gconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
163
163
.PHONY : pass1 pass1dep
164
164
.PHONY : pass2 pass2dep
165
+ .PHONY : host_info checkpython3
165
166
166
167
# Target used to copy include/nuttx/lib/math.h. If CONFIG_ARCH_MATH_H is
167
168
# defined, then there is an architecture specific math.h header file
@@ -618,6 +619,35 @@ bootloader:
618
619
clean_bootloader :
619
620
$(Q ) $(MAKE ) -C $(ARCH_SRC ) clean_bootloader
620
621
622
+ checkpython3 :
623
+ @if [ -z " $$ (which python3)" ]; then \
624
+ echo " ERROR: python3 not found in PATH" ; \
625
+ echo " Please install python3 or fix the PATH" ; \
626
+ exit 1; \
627
+ fi
628
+
629
+ # host_info target flags to get diagnostic info without building nxdiag application
630
+
631
+ SYSINFO_PARSE_FLAGS = "$(realpath $(TOPDIR ) ) "
632
+ SYSINFO_PARSE_FLAGS += "-finclude/sysinfo.h"
633
+
634
+ SYSINFO_FLAGS = "-c"
635
+ SYSINFO_FLAGS += "-p"
636
+ SYSINFO_FLAGS += -f \""$(shell echo '$(CFLAGS ) ' | sed 's/"/\\\\\\"/g') "\"
637
+ SYSINFO_FLAGS += \""$(shell echo '$(CXXFLAGS ) ' | sed 's/"/\\\\\\"/g') "\"
638
+ SYSINFO_FLAGS += \""$(shell echo '$(LDFLAGS ) ' | sed 's/"/\\\\\\"/g') "\"
639
+ SYSINFO_FLAGS += "--target_info"
640
+
641
+ # host_info: Parse nxdiag example output file (sysinfo.h) and print
642
+
643
+ host_info : checkpython3
644
+ @if [[ ! -f " include/sysinfo.h" ]]; then \
645
+ echo " file sysinfo.h not exists" ; \
646
+ python3 $(TOPDIR )$(DELIM ) tools$(DELIM ) host_info_dump.py $(SYSINFO_FLAGS ) \
647
+ $(realpath $(TOPDIR ) ) > include/sysinfo.h; \
648
+ fi
649
+ @python3 $(TOPDIR )$(DELIM ) tools$(DELIM ) host_info_parse.py $(SYSINFO_PARSE_FLAGS )
650
+
621
651
# pass1dep: Create pass1 build dependencies
622
652
# pass2dep: Create pass2 build dependencies
623
653
@@ -801,6 +831,7 @@ endif
801
831
$(call DELFILE, .config.orig)
802
832
$(call DELFILE, .config.backup)
803
833
$(call DELFILE, .gdbinit)
834
+ $(call DELFILE, include/sysinfo.h)
804
835
805
836
# Application housekeeping targets. The APPDIR variable refers to the user
806
837
# application directory. A sample apps/ directory is included with NuttX,
0 commit comments