优化构建系统

This commit is contained in:
pointer-to-bios 2024-01-16 20:39:47 +08:00
parent 13d933aad9
commit 85e0d52783
20 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,6 @@
ARCH := $(shell uname -m)
SOURCE := $(shell pwd)/scripts
PWD := $(shell pwd)
SOURCE := ${PWD}/scripts
ifeq (${ARCH},x86_64)
ASM = nasm
ASMFLAGS = -f elf64
@ -11,7 +12,7 @@ endif
SUBOBJS = kernel/kernel.o libk/libk.o
DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}"
DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}" PWD="${PWD}"
ifdef release
DEFINES := ${DEFINES} release=1
endif

View File

@ -1,15 +1,17 @@
.SUFFIXES:
################################
# C语言环境变量
CC = gcc
CCFLAGS = -m64 -mcmodel=large -I ../include \
CCFLAGS = -m64 -mcmodel=large -I ../../include \
-fno-stack-protector -fno-exceptions \
-fno-builtin -nostdinc -nostdlib
ifdef release
CCFLAGS := ${CCFLAGS} -O2
endif
C_SRCS = main.c tty.c klog.c font.c memm.c memm_${ARCH}.c raw.c
C_SRCS = main.c tty.c font.c memm.c memm_${ARCH}.c raw.c
C_OBJS = ${C_SRCS:.c=.c.o}
################################
@ -17,9 +19,9 @@ C_OBJS = ${C_SRCS:.c=.c.o}
################################
# rust语音环境变量
RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin
RSCFLAGS = --emit obj --crate-type lib -L crate="${PWD}/src/"
RS_SRCS =
RS_SRCS = klog.rs
RS_OBJS = ${RS_SRCS:.rs=.rs.o}
################################
@ -34,7 +36,7 @@ endif
ASMFLAGS := ${ASMFLAGS}
ASMFLAGS32 = -f elf32
S_SRCS = entry32.s entry.s memm_${ARCH}_s.s
S_SRCS = entry32.s entry.s memm_${ARCH}.s
S_OBJS = ${S_SRCS:.s=.s.o}
################################

View File

View File

@ -1,13 +1,10 @@
ARCH := $(shell uname -m)
ifdef release
release = 1
endif
.SUFFIXES:
################################
# C语言环境变量
CC = gcc
CCFLAGS = -m64 -mcmodel=large -I ../include \
CCFLAGS = -m64 -mcmodel=large -I ../../include \
-fno-stack-protector -fno-exceptions \
-fno-builtin -nostdinc -nostdlib
ifdef release
@ -22,7 +19,7 @@ C_OBJS = ${C_SRCS:.c=.c.o}
################################
# rust语音环境变量
RSCFLAGS = --emit=obj --target x86_64-unknown-linux-gnu --crate-type=bin
RSCFLAGS = --emit obj --crate-type lib -L crate="${PWD}/src/"
RS_SRCS =
RS_OBJS = ${RS_SRCS:.rs=.rs.o}