1*b087521eSChiichenCC=$(DragonOS_GCC)/x86_64-elf-gcc 2*b087521eSChiichenLD=ld 3*b087521eSChiichenOBJCOPY=objcopy 4*b087521eSChiichen# 修改这里,把它改为你的relibc的sysroot路径 5*b087521eSChiichenRELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) 6*b087521eSChiichenCFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ 7*b087521eSChiichen 8*b087521eSChiichentmp_output_dir=$(ROOT_PATH)/bin/tmp/user 9*b087521eSChiichenoutput_dir=$(DADK_BUILD_CACHE_DIR_TEST_UART_0_1_0) 10*b087521eSChiichen 11*b087521eSChiichenLIBC_OBJS:=$(shell find $(RELIBC_OPT)/lib -name "*.o" | sort ) 12*b087521eSChiichenLIBC_OBJS+=$(RELIBC_OPT)/lib/libc.a 13*b087521eSChiichen 14*b087521eSChiichenall: main.o 15*b087521eSChiichen mkdir -p $(tmp_output_dir) 16*b087521eSChiichen 17*b087521eSChiichen $(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test_uart $(shell find . -name "*.o") $(LIBC_OBJS) -T link.lds 18*b087521eSChiichen 19*b087521eSChiichen $(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/test_uart $(output_dir)/test_uart.elf 20*b087521eSChiichen mv $(output_dir)/test_uart.elf $(output_dir)/test_uart 21*b087521eSChiichenmain.o: main.c 22*b087521eSChiichen $(CC) $(CFLAGS) -c main.c -o main.o 23*b087521eSChiichen 24*b087521eSChiichenclean: 25*b087521eSChiichen rm -f *.o