From ed30e09f0133a2a82382383c5a8cf9c5611d4331 Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Mon, 1 Jan 2024 02:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80kernel=E5=92=8Clibk=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E9=83=A8=E5=88=86=E7=9A=84make?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/kernel/Makefile | 16 +++++++++------- src/libk/Makefile | 15 +++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/kernel/Makefile b/src/kernel/Makefile index ddcc6e7..969fe82 100644 --- a/src/kernel/Makefile +++ b/src/kernel/Makefile @@ -10,7 +10,7 @@ ifdef release endif C_SRCS = main.c tty.c klog.c font.c memm.c memm_${ARCH}.c raw.c -C_OBJS = ${C_SRCS:.c=.o} +C_OBJS = ${C_SRCS:.c=.c.o} ################################ @@ -19,7 +19,8 @@ C_OBJS = ${C_SRCS:.c=.o} RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin -RS_OBJS = +RS_SRCS = +RS_OBJS = ${RS_SRCS:.rs=.rs.o} ################################ @@ -33,7 +34,8 @@ endif ASMFLAGS := ${ASMFLAGS} ASMFLAGS32 = -f elf32 -S_OBJS = entry32.32.o entry.o memm_${ARCH}_s.o +S_SRCS = entry32.s entry.s memm_${ARCH}_s.s +S_OBJS = ${S_SRCS:.s=.s.o} ################################ @@ -46,22 +48,22 @@ OBJCOPY_FLAGS = ${STRIP_SECS} # 子目录 VPATH = memm/ memm/allocator tty/ klog/ arch/${ARCH} -%.o: %.c +%.c.o: %.c @echo -e "\e[1m\e[33m${CC}\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @${CC} -c ${CCFLAGS} $< -o $@ -%.o: %.rs +%.rs.o: %.rs @echo -e "\e[1m\e[33mrustc\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @rustc ${RSCFLAGS} $< -o $@ -%.32.o: arch/${ARCH}/%.s +%32.s.o: arch/${ARCH}/%32.s @echo -e "\e[1m\e[33m${ASM}\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @${ASM} ${ASMFLAGS32} -o $@ $< 2>&1 \ | "${SOURCE}/colorize" "warning:=pink" "error:=red" @objcopy -I elf32-i386 -O elf64-x86-64 $@ $@ 2>&1 \ | "${SOURCE}/colorize" "warning:=pink" "error:=red" "objcopy=lyellow" -%.o: arch/${ARCH}/%.s +%.s.o: arch/${ARCH}/%.s @echo -e "\e[1m\e[33m${ASM}\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @${ASM} ${ASMFLAGS} -o $@ $< 2>&1 | "${SOURCE}/colorize" "warning:=pink" "error:=red" diff --git a/src/libk/Makefile b/src/libk/Makefile index 3d987e9..3bbd251 100644 --- a/src/libk/Makefile +++ b/src/libk/Makefile @@ -14,7 +14,8 @@ ifdef release CCFLAGS := ${CCFLAGS} -O2 endif -C_OBJS = bootinfo.o lst.o +C_SRCS = bootinfo.c lst.c +C_OBJS = ${C_SRCS:.c=.c.o} ################################ @@ -23,7 +24,8 @@ C_OBJS = bootinfo.o lst.o RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin -RS_OBJS = +RS_SRCS = +RS_OBJS = ${RS_SRCS:.rs=.rs.o} ################################ @@ -36,7 +38,8 @@ endif ASMFLAGS := ${ASMFLAGS} -S_OBJS = memset.o memcpy.o +S_SRCS = memset.s memcpy.s +S_OBJS = ${S_SRCS:.s=.s.o} ################################ @@ -49,15 +52,15 @@ OBJCOPY_FLAGS = ${STRIP_SECS} # 子目录 VPATH = multiboot2/ string/ -%.o: %.c +%.c.o: %.c @echo -e "\e[1m\e[33m${CC}\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @${CC} -c ${CCFLAGS} $< -o $@ -%.o: %.rs +%.rs.o: %.rs @echo -e "\e[1m\e[33mrustc\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @rustc ${RSCFLAGS} $< -o $@ -%.o: arch/${ARCH}/%.s +%.s.o: arch/${ARCH}/%.s @echo -e "\e[1m\e[33m${ASM}\e[0m \e[32m$<\e[0m \e[34m-->\e[0m \e[1m\e[32m$@\e[0m" @${ASM} ${ASMFLAGS} -o $@ $< 2>&1 | "${SOURCE}/colorize" "warning:=pink" "error:=red"