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