Update makefile
This commit is contained in:
parent
38743e0b56
commit
80355d09eb
27
makefile
27
makefile
|
|
@ -1,12 +1,39 @@
|
||||||
EXEC_DIR=$(shell find -type d -name $(target_dir)*)
|
EXEC_DIR=$(shell find -type d -name $(target_dir)*)
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
|
ifneq ($(shell arch), 'riscv64')
|
||||||
|
|
||||||
|
ifeq ($(shell id -u), 0)
|
||||||
|
@apt update -y
|
||||||
|
@apt-get install gcc-riscv64-unknown-elf qemu-user -y
|
||||||
|
else
|
||||||
|
@echo 'Please, run this command with sudo!'
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
@echo 'Is not necessary install packages to riscv64 CPU!'
|
||||||
|
endif
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
||||||
|
ifeq ($(shell arch), 'riscv64')
|
||||||
@as -o $(EXEC_DIR)/output.out $(EXEC_DIR)/*.s
|
@as -o $(EXEC_DIR)/output.out $(EXEC_DIR)/*.s
|
||||||
@ld -o $(EXEC_DIR)/output $(EXEC_DIR)/output.out
|
@ld -o $(EXEC_DIR)/output $(EXEC_DIR)/output.out
|
||||||
|
else
|
||||||
|
@riscv64-unknown-elf-as -o $(EXEC_DIR)/output.out $(EXEC_DIR)/*.s
|
||||||
|
@riscv64-unknown-elf-ld -o $(EXEC_DIR)/output $(EXEC_DIR)/output.out
|
||||||
|
endif
|
||||||
|
|
||||||
run:
|
run:
|
||||||
$(MAKE) build
|
$(MAKE) build
|
||||||
|
|
||||||
|
ifeq ($(shell arch), 'riscv64')
|
||||||
@$(EXEC_DIR)/output $(EXEC)
|
@$(EXEC_DIR)/output $(EXEC)
|
||||||
|
else
|
||||||
|
@qemu-riscv64 $(EXEC_DIR)/output $(EXEC)
|
||||||
|
endif
|
||||||
|
|
||||||
$(MAKE) clear
|
$(MAKE) clear
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue