[PATCH] Store kernel compiler options

From: Rui Sousa (rsousa@grad.physics.sunysb.edu)
Date: Sat Feb 26 2000 - 22:47:01 EST


Hi,

This is a small patch to the kernel top Makefile to
store the kernel compiler options in include/linux/compiler.options
The patch is against 2.3.47.

I believe this makes module compilation, outside the kernel three, much
easier. The same compiler options used for the kernel can be used for
the module by simply including include/linux/compiler.options in it's makefile.

This seems specially useful for compiling a module for a prepackaged kernel
having only the original kernel headers available.

Comments anyone?

Rui Sousa

diff -urN linux-2.3.old/Makefile linux-2.3/Makefile
--- linux-2.3.old/Makefile Sat Feb 26 21:51:30 2000
+++ linux-2.3/Makefile Sat Feb 26 22:14:49 2000
@@ -267,7 +267,7 @@
 boot: vmlinux
         @$(MAKE) -C arch/$(ARCH)/boot
 
-vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
+vmlinux: $(CONFIGURATION) include/linux/compiler.options init/main.o init/version.o linuxsubdirs
         $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
                 --start-group \
                 $(CORE_FILES) \
@@ -310,6 +310,7 @@
 
 $(TOPDIR)/include/linux/version.h: include/linux/version.h
 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
+$(TOPDIR)/include/linux/compiler.options: include/linux/compiler.options
 
 newversion:
         @if [ ! -f .version ]; then \
@@ -342,6 +343,14 @@
         @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
         @mv -f .ver $@
 
+include/linux/compiler.options: ./Makefile
+ @echo HOSTCC := $(HOSTCC) > .ver
+ @echo HOSTCFLAGS := $(HOSTCFLAGS) >> .ver
+ @echo CPPFLAGS := $(CPPFLAGS) >> .ver
+ @echo CFLAGS := $(CFLAGS) >> .ver
+ @echo AFLAGS := $(AFLAGS) >> .ver
+ @mv -f .ver $@
+
 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
         $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
 
@@ -431,7 +440,7 @@
 endif
 
 clean: archclean
- rm -f kernel/ksyms.lst include/linux/compile.h
+ rm -f kernel/ksyms.lst include/linux/compile.h include/linux/compiler.options
         find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f
         rm -f core `find . -type f -name 'core' -print`
         rm -f core `find . -type f -name '.*.flags' -print`

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:16 EST