BUILD_DIR := /lib/modules/$(shell uname -r)/build
OUTPUT_DIR := scratchpad/kmod
-# authored module basenames (without .mod.c)
+# authored module basenames (without .kmod.c)
BASE_LIST := $(patsubst %.kmod.c,%,$(notdir $(wildcard cc/*.kmod.c)))
# paths in scratchpad/kmod
@mkdir -p $(OUTPUT_DIR)
@printf "obj-m := %s\n" "$(foreach m,$(BASE_LIST),$(m).o)" > $(OUTPUT_DIR)/Makefile
-# copy authored .mod.c → scratchpad/kmod/*.c (Kbuild expects sources under M)
-$(OUTPUT_DIR)/%.c: $(SOURCE_DIR)/%.mod.c | _prepare
+# copy authored .kmod.c → scratchpad/kmod/*.c (Kbuild expects sources under M)
+$(OUTPUT_DIR)/%.c: $(SOURCE_DIR)/%.kmod.c | _prepare
@echo "--- Preparing Kbuild Source: $@ ---"
cp $< $@
# bail early if there is no compiler
ifeq ($(C),)
- $(error No C compiler specified.)
+ $(error target_lib_cli.mk: no C compiler specified.)
endif
# keep only the source directories that are in the file system
# bail early if the SRCDIR_list is empty
ifeq ($(SRCDIR_LIST),)
- exit
+ @printf "target_lib_cli.mk: empty SRCDIR_LIST"
+ exit 0
endif
# duplicate source file names in different directories will cause