Skip to content

Commit 4bf9454

Browse files
authored
Split up objects in makefile (#63)
* Splits up the list of objects. This makes it easier to merge them together when merging or rebasing. Signed-off-by: Amy Ringo <me@remexre.com> * Fixes dependencies in Makefile to rebuild after reconfiguring. This lets us get rid of the warning for that in the configure script itself. Signed-off-by: Amy Ringo <me@remexre.com> --------- Signed-off-by: Amy Ringo <me@remexre.com>
1 parent ecd7f5e commit 4bf9454

File tree

4 files changed

+36
-12
lines changed

4 files changed

+36
-12
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,24 @@ watch:
6767
.SUFFIXES:
6868

6969
define common_rules_for_dir
70-
$(2)%.o: $(srcdir)/$(2)%.c
70+
$(2)%.o: $(srcdir)/$(2)%.c config.mak
7171
@mkdir -p $$(dir $$@)
7272
@echo "CC $$@"
7373
$(Q)$(CC) -c -o $$@ $$($(1)-cflags) $$<
7474

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

8080
# https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html
81-
$(2)%.d: $(srcdir)/$(2)%.c
81+
$(2)%.d: $(srcdir)/$(2)%.c config.mak
8282
@mkdir -p $$(dir $$@)
8383
@set -e; rm -f $$@; \
8484
trap 'rm -f $$@.$$$$$$$$' EXIT; \
8585
$(CC) -M $$($(1)-cflags) $$< > $$@.$$$$$$$$; \
8686
sed 's,$$(notdir $$(@:%.d=%.o))[ :]*,$$(@:%.d=%.o) $$@ : ,g' < $$@.$$$$$$$$ > $$@
87-
$(2)%.d: $(srcdir)/$(2)%.S
87+
$(2)%.d: $(srcdir)/$(2)%.S config.mak
8888
@mkdir -p $$(dir $$@)
8989
@set -e; rm -f $$@; \
9090
trap 'rm -f $$@.$$$$$$$$' EXIT; \

configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ if [[ -e Makefile ]]; then
117117
if [[ "$(realpath Makefile)" != "$(realpath "$repo/Makefile")" ]]; then
118118
printf >&2 './configure: a different Makefile already exists\n'
119119
exit 1
120-
else
121-
printf >&2 "./configure: already configured; you probably want to run \`make clean' to get rid of old build artifacts\n"
122120
fi
123121
else
124122
ln -s "$repo/Makefile" Makefile

src/kernel/arch/riscv64/include.mak

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ kernel-cflags += \
88
-mabi=lp64 \
99
-mcmodel=medany
1010
kernel-objs-asm += arch/riscv64/start
11-
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
11+
kernel-objs-c += arch/riscv64/backtrace
12+
kernel-objs-c += arch/riscv64/hart_locals
13+
kernel-objs-c += arch/riscv64/paging
14+
kernel-objs-c += arch/riscv64/panic
15+
kernel-objs-c += arch/riscv64/physical
16+
kernel-objs-c += arch/riscv64/random
17+
kernel-objs-c += arch/riscv64/sbi
1218

1319
$(eval $(call compute_component_variables,kernel))
1420

src/kernel/include.mak

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,29 @@ kernel-cflags = $(CFLAGS) \
2121
kernel-cflags += -fdata-sections -ffunction-sections
2222
kernel-ldflags += -Wl,--gc-sections
2323
kernel-dir = src/kernel
24-
kernel-objs-asm =
25-
kernel-objs-c = devicetree main panic print random selftest swar_test symbolicate
26-
kernel-objs-c += builtins/bzero builtins/explicit_bzero builtins/memcpy builtins/memcmp builtins/memset builtins/strcmp builtins/strlen
27-
kernel-objs-c += crypto/subtle/rfc7539 crypto/subtle/rfc7693
28-
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
24+
kernel-objs-c += builtins/bzero
25+
kernel-objs-c += builtins/explicit_bzero
26+
kernel-objs-c += builtins/memcmp
27+
kernel-objs-c += builtins/memcpy
28+
kernel-objs-c += builtins/memset
29+
kernel-objs-c += builtins/strcmp
30+
kernel-objs-c += builtins/strlen
31+
kernel-objs-c += crypto/subtle/rfc7539
32+
kernel-objs-c += crypto/subtle/rfc7693
33+
kernel-objs-c += devicetree
34+
kernel-objs-c += main
35+
kernel-objs-c += mm/alloc
36+
kernel-objs-c += mm/alloc/block
37+
kernel-objs-c += mm/alloc/heap
38+
kernel-objs-c += mm/alloc/init
39+
kernel-objs-c += mm/alloc/page
40+
kernel-objs-c += mm/alloc/segment
41+
kernel-objs-c += mm/physical_alloc
42+
kernel-objs-c += mm/virtual_alloc
43+
kernel-objs-c += panic
44+
kernel-objs-c += print
45+
kernel-objs-c += random
46+
kernel-objs-c += selftest
47+
kernel-objs-c += swar_test
48+
kernel-objs-c += symbolicate
2949
include $(srcdir)/src/kernel/arch/$(arch)/include.mak

0 commit comments

Comments
 (0)