Miquel van Smoorenburg wrote:
> .. but there should be a cleaner way to get at the CFLAGS used
> to compile the kernel.

There is a way though I'd not call it clean.  Here is an extract from
the Makefile I am using for separately-distributed modules.  It should
work with kernels 2.0 to 2.4, all supported architectures.

include $(KERNEL_SOURCE)/.config

CPPFLAGS := -DMODULE -D__KERNEL__ -nostdinc -I$(KERNEL_SOURCE)/include
CPPFLAGS += -I$(shell gcc -print-file-name=include)
CFLAGS   := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
AFLAGS   := -D__ASSEMBLY__ $(CPPFLAGS)

# For older kernels.
ifneq (,$(strip $(shell grep '^[        ]*SMP[  ]*:\?=[         ]*[^    ]' 
$(KERNEL_SOURCE)/Makefile)))
CONFIG_SMP=y
endif
ifdef CONFIG_SMP
CFLAGS += -D__SMP__
AFLAGS += -D__SMP__
endif

include $(KERNEL_SOURCE)/arch/$(ARCH)/Makefile

CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null 
>/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to