bsp,am,Makefile: generate files.mk from scons commands

This commit is contained in:
Zihao Yu 2023-05-24 10:30:08 +08:00
parent 397bc03c19
commit e5c449a67d
2 changed files with 18 additions and 2 deletions

View file

@ -1 +1,2 @@
rtconfig.h
files.mk

View file

@ -1,14 +1,29 @@
ARCH ?= native
FILE_MK = files.mk
FILE_TMP = .tmp.$(FILE_MK)
RTCONFIG_H = rtconfig.h
NAME = rtthread
SRCS =
-include $(FILE_MK)
include $(AM_HOME)/Makefile
$(RTCONFIG_H):
touch $@
scons --useconfig=.config
init: $(RTCONFIG_H)
$(FILE_MK): $(RTCONFIG_H)
scons -c
scons --verbose -n > $(FILE_TMP)
cat $(FILE_TMP) | grep -o '[^ ]*.c$$' | awk '{print "SRCS += " $$1}' > $@
cat $(FILE_TMP) | grep 'gcc ' | head -n 1 | grep -o " -I[^ ]*" | awk '{print "CFLAGS += " $$1}' >> $@
rm $(FILE_TMP)
.PHONY: init
menuconfig:
scons --menuconfig
scons --genconfig
$(MAKE) init
init: $(FILE_MK)
.PHONY: init menuconfig