[klibc] [PATCH] klibc: support for make dir/file.i, make dir/file.s

Sam Ravnborg sam at ravnborg.org
Mon Apr 3 14:45:16 PDT 2006


Implement support for:
make dir/file.i  => Generate preprocessed source code
make dir/file.s  => Generate assembler code

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>
---
This should complete it for now for klibc.

	Sam

diff --git a/Makefile b/Makefile
index b05847e..51366b1 100644
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,12 @@ test: klibc
 %.o: %.c FORCE
 	 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
 
+%.s: %.c FORCE
+	 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
+
+%.i: %.c FORCE
+	 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
+
 FORCE: ;
 ###
 # clean: remove generated files
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index b531917..93f558b 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -200,6 +200,11 @@ quiet_cmd_cc_o_c = KLIBCCC $@
 %.o: %.c FORCE
 	$(call if_changed_dep,cc_o_c)
 
+quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@
+      cmd_cc_i_c = $(KLIBCCC) -E $(klibccflags) -o $@ $<
+%.i: %.c FORCE
+	$(call if_changed_dep,cc_i_c)
+
 # Compile assembler sources (.S)
 # ---------------------------------------------------------------------------
 



More information about the klibc mailing list