aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-11-01 09:03:12 +0200
committeraqua <aqua@iserlohn-fortress.net>2022-11-01 09:03:12 +0200
commit848b3174bbcdb6d21011ed17c1e14751abf9fba3 (patch)
treebb07452b0708d321ce37964f4e87da7242edf7a0
parentadd ps2_keyboard driver (diff)
downloadkernel-848b3174bbcdb6d21011ed17c1e14751abf9fba3.tar.xz
makefile: clean target shouldn't depend on OBJS
-rw-r--r--Makefile6
-rw-r--r--devices/Makefile2
-rw-r--r--i686/Makefile2
-rw-r--r--lib/Makefile2
-rw-r--r--rules.mk6
-rw-r--r--src/Makefile2
6 files changed, 8 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index da1daa4..aa6965e 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,11 @@ info:
@echo " LD $(shell ${LD} --version | head -n1)"
.PHONY: all run clean purge
-all: lib/libk.a ${ARCH}/arch.a devices/devs.a src/kernel.a
+all:
+ @${MAKE} ARCH=${ARCH} -C lib all
+ @${MAKE} ARCH=${ARCH} -C ${ARCH} all
+ @${MAKE} ARCH=${ARCH} -C devices all
+ @${MAKE} ARCH=${ARCH} -C src all
run: glitch.iso
qemu-system-i386 -cdrom glitch.iso -accel kvm
diff --git a/devices/Makefile b/devices/Makefile
index 0e07a83..a73645f 100644
--- a/devices/Makefile
+++ b/devices/Makefile
@@ -2,8 +2,6 @@ include ../${ARCH}/toolchain.mk
CCFLAGS += -I. -I../${ARCH} -I../lib
-all: devs.a
-
devs,SRCS = pic_8259.c uart_16550.c vga.c ps2_keyboard.c
include ../rules.mk
diff --git a/i686/Makefile b/i686/Makefile
index d472ebe..04257dc 100644
--- a/i686/Makefile
+++ b/i686/Makefile
@@ -2,8 +2,6 @@ include ../${ARCH}/toolchain.mk
CCFLAGS += -I../grub/include -I../lib
-all: arch.a
-
arch,SRCS = boot.S init.s \
gdt.c lgdt.c \
lidt.c isr.c
diff --git a/lib/Makefile b/lib/Makefile
index 85d1f34..8645c45 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,8 +2,6 @@ include ../${ARCH}/toolchain.mk
CCFLAGS += -I. -I..
-all: libk.a
-
libk,SRCS = memcpy.c memset.c stdio/printf.c string/itoa.c
include ../rules.mk
diff --git a/rules.mk b/rules.mk
index 152cc74..e5ba185 100644
--- a/rules.mk
+++ b/rules.mk
@@ -1,9 +1,9 @@
-# generate ,OBJS variable for each ,SRCS
+# for each target,SRCS, generate target,OBJS, target.a and add target,OBJS to all
, = ,
$(foreach V,$(filter %$(,)SRCS, ${.VARIABLES}),\
$(eval $(V:$(,)SRCS=$(,)OBJS) += $(foreach f,$($(V)),$(addsuffix .o,$(basename $(f))))) \
$(eval $(V:$(,)SRCS=.a): $($(V:$(,)SRCS=$(,)OBJS))) \
- $(eval clean: $($(V:$(,)SRCS=$(,)OBJS))) \
+ $(eval all: $($(V:$(,)SRCS=$(,)OBJS))) \
)
# Suffix rules
@@ -27,4 +27,4 @@ $(foreach V,$(filter %$(,)SRCS, ${.VARIABLES}),\
# clean target
.PHONY: clean
clean:
- @rm -rf $^
+ @$(foreach V,$(filter %$(,)OBJS, ${.VARIABLES}), rm -rf $($(V)))
diff --git a/src/Makefile b/src/Makefile
index 881b7c2..e1fb529 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,8 +2,6 @@ include ../${ARCH}/toolchain.mk
CCFLAGS += -I. -isystem../grub/include -I../${ARCH} -I../lib -I..
-all: kernel.a
-
conf.h: conf.h.in
@cp conf.h.in conf.h
@sed -i 's/@VERSION@/$(shell git describe)/' conf.h