1*be63f3b2ShoumkhCC=$(DragonOS_GCC)/x86_64-elf-gcc 2*be63f3b2ShoumkhLD=ld 3*be63f3b2ShoumkhOBJCOPY=objcopy 4*be63f3b2Shoumkh# 修改这里,把它改为你的relibc的sysroot路径 5*be63f3b2ShoumkhRELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) 6*be63f3b2ShoumkhCFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ 7*be63f3b2Shoumkh 8*be63f3b2Shoumkhtmp_output_dir=$(ROOT_PATH)/bin/tmp/user 9*be63f3b2Shoumkhoutput_dir=$(DADK_BUILD_CACHE_DIR_TEST_FSTAT_0_1_0) 10*be63f3b2Shoumkh 11*be63f3b2ShoumkhLIBC_OBJS:=$(shell find $(RELIBC_OPT)/lib -name "*.o" | sort ) 12*be63f3b2ShoumkhLIBC_OBJS+=$(RELIBC_OPT)/lib/libc.a 13*be63f3b2Shoumkh 14*be63f3b2Shoumkhall: main.o 15*be63f3b2Shoumkh mkdir -p $(tmp_output_dir) 16*be63f3b2Shoumkh 17*be63f3b2Shoumkh $(LD) -b elf64-x86-64 -z muldefs -o $(tmp_output_dir)/test_fstat $(shell find . -name "*.o") $(LIBC_OBJS) -T link.lds 18*be63f3b2Shoumkh 19*be63f3b2Shoumkh $(OBJCOPY) -I elf64-x86-64 -R ".eh_frame" -R ".comment" -O elf64-x86-64 $(tmp_output_dir)/test_fstat $(output_dir)/test_fstat.elf 20*be63f3b2Shoumkh 21*be63f3b2Shoumkh mv $(output_dir)/test_fstat.elf $(output_dir)/test_fstat 22*be63f3b2Shoumkhmain.o: main.c 23*be63f3b2Shoumkh $(CC) $(CFLAGS) -c main.c -o main.o 24*be63f3b2Shoumkh 25*be63f3b2Shoumkhclean: 26*be63f3b2Shoumkh rm -f *.o