build: clean known object files

If there was an object file in a subdirectory, it didn't get cleaned prior
to this change.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 7 insertions(+), 3 deletions(-)

M build.mk
M build.mk +7 -3
@@ 1,5 1,5 @@ 
 #
-# Copyright (c) 2022-2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+# Copyright (c) 2022-2024 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal

          
@@ 46,8 46,8 @@ all: ${BINS} ${HEXS}
 	${SIZE} ${ELFS}
 
 .PHONY: clean
-clean:
-	rm -f ${ELFS} ${BINS} ${HEXS} ivec.*.S *.o
+clean: ${MCUS:C/^/clean_/}
+	rm -f ${ELFS} ${BINS} ${HEXS}
 
 .for mcu in ${MCUS}
 OBJS_${mcu}=\

          
@@ 95,4 95,8 @@ ivec.${mcu}.S: mcu.mk
 
 ${NAME}-${mcu}.ihex: ${NAME}-${mcu}.elf
 	${OBJCOPY} -O ihex ${.ALLSRC} ${.TARGET}
+
+clean_${mcu}:
+	rm -f ivec.${mcu}.S ${OBJS_${mcu}}
+
 .endfor