统一kernel和libk两个部分的make

This commit is contained in:
pointer-to-bios 2024-01-01 02:45:46 +08:00
parent 4092d58ede
commit ed30e09f01
2 changed files with 18 additions and 13 deletions

View File

@ -10,7 +10,7 @@ ifdef release
endif endif
C_SRCS = main.c tty.c klog.c font.c memm.c memm_${ARCH}.c raw.c 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 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} ASMFLAGS := ${ASMFLAGS}
ASMFLAGS32 = -f elf32 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} 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" @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 $@ @${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" @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 $@ @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" @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 \ @${ASM} ${ASMFLAGS32} -o $@ $< 2>&1 \
| "${SOURCE}/colorize" "warning:=pink" "error:=red" | "${SOURCE}/colorize" "warning:=pink" "error:=red"
@objcopy -I elf32-i386 -O elf64-x86-64 $@ $@ 2>&1 \ @objcopy -I elf32-i386 -O elf64-x86-64 $@ $@ 2>&1 \
| "${SOURCE}/colorize" "warning:=pink" "error:=red" "objcopy=lyellow" | "${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" @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" @${ASM} ${ASMFLAGS} -o $@ $< 2>&1 | "${SOURCE}/colorize" "warning:=pink" "error:=red"

View File

@ -14,7 +14,8 @@ ifdef release
CCFLAGS := ${CCFLAGS} -O2 CCFLAGS := ${CCFLAGS} -O2
endif 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 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} 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/ 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" @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 $@ @${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" @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 $@ @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" @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" @${ASM} ${ASMFLAGS} -o $@ $< 2>&1 | "${SOURCE}/colorize" "warning:=pink" "error:=red"