2021-08-16 02:44:56 +00:00
|
|
|
ARCH_SPLIT = $(subst -, ,$(ARCH))
|
|
|
|
ISA = $(word 1,$(ARCH_SPLIT))
|
|
|
|
PLATFORM = $(word 2,$(ARCH_SPLIT))
|
|
|
|
|
|
|
|
ifneq ($(PLATFORM), nemu)
|
|
|
|
$(error Only support with NEMU)
|
|
|
|
endif
|
|
|
|
|
|
|
|
TMPDEFCONFIG = tmp_defconfig
|
2021-08-27 11:23:59 +00:00
|
|
|
TMPDEFCONFIG_FILE = $(NEMU_HOME)/configs/$(TMPDEFCONFIG)
|
2021-08-16 02:44:56 +00:00
|
|
|
|
|
|
|
all:
|
|
|
|
$(MAKE) save_config
|
|
|
|
$(MAKE) build_am
|
|
|
|
$(MAKE) restore_config
|
|
|
|
$(MAKE) -C $(NEMU_HOME) run IMG=$(NEMU_HOME)/build/$(ISA)-nemu-interpreter-$(ARCH).bin
|
|
|
|
|
|
|
|
save_config:
|
|
|
|
$(MAKE) -C $(NEMU_HOME) savedefconfig
|
2021-08-27 11:23:59 +00:00
|
|
|
mv $(NEMU_HOME)/configs/defconfig $(TMPDEFCONFIG_FILE)
|
2021-08-16 02:44:56 +00:00
|
|
|
|
|
|
|
build_am:
|
|
|
|
$(MAKE) -C $(NEMU_HOME) $(ISA)-am_defconfig
|
2021-08-27 11:23:59 +00:00
|
|
|
$(MAKE) -C $(NEMU_HOME) ARCH=$(ARCH) mainargs=$(mainargs) || \
|
|
|
|
($(MAKE) restore_config; false)
|
2021-08-16 02:44:56 +00:00
|
|
|
|
|
|
|
restore_config:
|
|
|
|
$(MAKE) -C $(NEMU_HOME) ARCH=$(ARCH) $(TMPDEFCONFIG)
|
2021-08-27 11:23:59 +00:00
|
|
|
rm $(TMPDEFCONFIG_FILE)
|
2021-08-16 02:44:56 +00:00
|
|
|
|
|
|
|
.PHONY: all save_config build_am restore_config
|