Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ watch:
.SUFFIXES:

define common_rules_for_dir
$(2)%.o: $(srcdir)/$(2)%.c
$(2)%.o: $(srcdir)/$(2)%.c config.mak
@mkdir -p $$(dir $$@)
@echo "CC $$@"
$(Q)$(CC) -c -o $$@ $$($(1)-cflags) $$<

$(2)%.o: $(srcdir)/$(2)%.S
$(2)%.o: $(srcdir)/$(2)%.S config.mak
@mkdir -p $$(dir $$@)
@echo "AS $$@"
$(Q)$(CC) -c -o $$@ $$($(1)-cflags) $$<

# https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html
$(2)%.d: $(srcdir)/$(2)%.c
$(2)%.d: $(srcdir)/$(2)%.c config.mak
@mkdir -p $$(dir $$@)
@set -e; rm -f $$@; \
trap 'rm -f $$@.$$$$$$$$' EXIT; \
$(CC) -M $$($(1)-cflags) $$< > $$@.$$$$$$$$; \
sed 's,$$(notdir $$(@:%.d=%.o))[ :]*,$$(@:%.d=%.o) $$@ : ,g' < $$@.$$$$$$$$ > $$@
$(2)%.d: $(srcdir)/$(2)%.S
$(2)%.d: $(srcdir)/$(2)%.S config.mak
@mkdir -p $$(dir $$@)
@set -e; rm -f $$@; \
trap 'rm -f $$@.$$$$$$$$' EXIT; \
Expand Down
2 changes: 0 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ if [[ -e Makefile ]]; then
if [[ "$(realpath Makefile)" != "$(realpath "$repo/Makefile")" ]]; then
printf >&2 './configure: a different Makefile already exists\n'
exit 1
else
printf >&2 "./configure: already configured; you probably want to run \`make clean' to get rid of old build artifacts\n"
fi
else
ln -s "$repo/Makefile" Makefile
Expand Down
8 changes: 7 additions & 1 deletion src/kernel/arch/riscv64/include.mak
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ kernel-cflags += \
-mabi=lp64 \
-mcmodel=medany
kernel-objs-asm += arch/riscv64/start
kernel-objs-c += arch/riscv64/backtrace arch/riscv64/hart_locals arch/riscv64/paging arch/riscv64/panic arch/riscv64/physical arch/riscv64/random arch/riscv64/sbi
kernel-objs-c += arch/riscv64/backtrace
kernel-objs-c += arch/riscv64/hart_locals
kernel-objs-c += arch/riscv64/paging
kernel-objs-c += arch/riscv64/panic
kernel-objs-c += arch/riscv64/physical
kernel-objs-c += arch/riscv64/random
kernel-objs-c += arch/riscv64/sbi

$(eval $(call compute_component_variables,kernel))

Expand Down
30 changes: 25 additions & 5 deletions src/kernel/include.mak
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,29 @@ kernel-cflags = $(CFLAGS) \
kernel-cflags += -fdata-sections -ffunction-sections
kernel-ldflags += -Wl,--gc-sections
kernel-dir = src/kernel
kernel-objs-asm =
kernel-objs-c = devicetree main panic print random selftest swar_test symbolicate
kernel-objs-c += builtins/bzero builtins/explicit_bzero builtins/memcpy builtins/memcmp builtins/memset builtins/strcmp builtins/strlen
kernel-objs-c += crypto/subtle/rfc7539 crypto/subtle/rfc7693
kernel-objs-c += mm/alloc mm/alloc/block mm/alloc/heap mm/alloc/init mm/alloc/page mm/alloc/segment mm/physical_alloc mm/virtual_alloc
kernel-objs-c += builtins/bzero
kernel-objs-c += builtins/explicit_bzero
kernel-objs-c += builtins/memcmp
kernel-objs-c += builtins/memcpy
kernel-objs-c += builtins/memset
kernel-objs-c += builtins/strcmp
kernel-objs-c += builtins/strlen
kernel-objs-c += crypto/subtle/rfc7539
kernel-objs-c += crypto/subtle/rfc7693
kernel-objs-c += devicetree
kernel-objs-c += main
kernel-objs-c += mm/alloc
kernel-objs-c += mm/alloc/block
kernel-objs-c += mm/alloc/heap
kernel-objs-c += mm/alloc/init
kernel-objs-c += mm/alloc/page
kernel-objs-c += mm/alloc/segment
kernel-objs-c += mm/physical_alloc
kernel-objs-c += mm/virtual_alloc
kernel-objs-c += panic
kernel-objs-c += print
kernel-objs-c += random
kernel-objs-c += selftest
kernel-objs-c += swar_test
kernel-objs-c += symbolicate
include $(srcdir)/src/kernel/arch/$(arch)/include.mak