diff --git a/bsp/abstract-machine/.gitignore b/bsp/abstract-machine/.gitignore index 7286b8f..27ab723 100644 --- a/bsp/abstract-machine/.gitignore +++ b/bsp/abstract-machine/.gitignore @@ -1 +1,2 @@ rtconfig.h +files.mk diff --git a/bsp/abstract-machine/Makefile b/bsp/abstract-machine/Makefile index c6d733d..d38542f 100644 --- a/bsp/abstract-machine/Makefile +++ b/bsp/abstract-machine/Makefile @@ -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