[klibc] [PATCH] klibc: support building individual files

Sam Ravnborg sam at ravnborg.org
Mon Apr 3 14:05:35 PDT 2006

Enable the syntax:
make dir/file.o

It has a few drawbacks:
- Works only for .c files
- Requires a Kbuild file in the same dir as the .c file

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>

Same functionality is not working in the kernel (yet).
Need to find a clean way to detect when to use which build


diff --git a/Makefile b/Makefile
index bfae8de..b05847e 100644
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,14 @@ klibc:
 test: klibc
 	$(Q)$(MAKE) $(klibc)=klibc/tests
+# allow one to say make dir/file.o
+# Caveat: works only for .c files where we have a Kbuild file in same dir
+%.o: %.c FORCE
+	 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
 # clean: remove generated files
 # mrproper does a full cleaning including .config and linux symlink

More information about the klibc mailing list