public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: miquels@cistron-office.nl (Miquel van Smoorenburg)
To: linux-kernel@vger.kernel.org
Subject: Re: build -->/usr/src/linux
Date: Mon, 9 Apr 2001 11:29:57 +0000 (UTC)	[thread overview]
Message-ID: <9as6fl$gmq$1@ncc1701.cistron.net> (raw)
In-Reply-To: <3AD079EA.50DA97F3@rcn.com> <3AD0A029.C17C3EFC@rcn.com> <9aqmci$gn2$1@ncc1701.cistron.net> <20010409010103.A16562@pcep-jamie.cern.ch>

In article <20010409010103.A16562@pcep-jamie.cern.ch>,
Jamie Lokier  <lk@tantalophile.demon.co.uk> wrote:
>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

Do you think something like this is the correct approach? If it
was part of the official kernel you could write a Makefile like this:

KSRC = /lib/modules/`uname -r`/build
include $(KSRC)/include/config.mak

CFLAGS := $(CFLAGS) $(MODFLAGS)

module.c:  module.h

--- linux-2.2.19.orig/Makefile	Mon Apr  9 13:01:37 2001
+++ linux-2.2.19/Makefile	Mon Apr  9 13:20:21 2001
@@ -325,7 +325,8 @@
 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
 endif
 
-modules: include/config/MARKER $(patsubst %, _mod_%, $(SUBDIRS))  
+modules: include/config/MARKER $(patsubst %, _mod_%, $(SUBDIRS))  \
+		include/linux/config.mak
 
 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
 	$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
@@ -380,6 +381,31 @@
 	@exit 1
 endif
 
+include/linux/config.mak: ./Makefile
+	@echo "VERSION		= $(VERSION)" > .mak
+	@echo "PATCHLEVEL	= $(PATCHLEVEL)" >> .mak
+	@echo "SUBLEVEL	= $(SUBLEVEL)" >> .mak
+	@echo "EXTRAVERSION	= $(EXTRAVERSION)" >> .mak
+	@echo "ARCH		= $(ARCH)" >> .mak
+	@echo "HOSTCC		= $(HOSTCC)" >> .mak
+	@echo "HOSTCFLAGS	= $(HOSTCFLAGS)" >> .mak
+	@echo "CROSS_COMPILE	= $(CROSS_COMPILE)" >> .mak
+	@echo "AS		= $(AS)" >> .mak
+	@echo "LD		= $(LD)" >> .mak
+	@echo "CC		= $(CC)" >> .mak
+	@echo "CPP		= $(CPP)" >> .mak
+	@echo "AR		= $(AR)" >> .mak
+	@echo "NM		= $(NM)" >> .mak
+	@echo "STRIP		= $(STRIP)" >> .mak
+	@echo "OBJCOPY		= $(OBJCOPY)" >> .mak
+	@echo "OBJDUMP		= $(OBJDUMP)" >> .mak
+	@echo "MAKE		= $(MAKE)" >> .mak
+	@echo "GENKSYMS	= $(GENKSYMS)" >> .mak
+	@echo "CFLAGS		= $(CFLAGS)" >> .mak
+	@echo "AFLAGS		= $(AFLAGS)" >> .mak
+	@echo "MODFLAGS	= $(MODFLAGS)" >> .mak
+	@mv -f .mak $@
+
 clean:	archclean
 	rm -f kernel/ksyms.lst include/linux/compile.h
 	rm -f core `find . -name '*.[oas]' ! \( -regex '.*lxdialog/.*' \
@@ -398,6 +424,7 @@
 
 mrproper: clean archmrproper
 	rm -f include/linux/autoconf.h include/linux/version.h
+	rm -f include/linux/config.mak
 	rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
 	rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
 	rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h


Mike.


  reply	other threads:[~2001-04-09 11:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9aqmgo$8f6ol$1@fido.engr.sgi.com>
2001-04-08 14:47 ` build -->/usr/src/linux Marvin Stodolsky
2001-04-08 15:16   ` Russell King
2001-04-08 17:30     ` Marvin Stodolsky
2001-04-08 21:49       ` Miquel van Smoorenburg
2001-04-08 23:01         ` Jamie Lokier
2001-04-09 11:29           ` Miquel van Smoorenburg [this message]
2001-04-09 15:02             ` Jamie Lokier
2001-04-09 23:01       ` richard offer
2001-04-10 14:08         ` Jamie Lokier
2001-04-10 16:36           ` richard offer
2001-04-10 16:42             ` Jamie Lokier
2001-04-10 16:52               ` richard offer
2001-04-10 17:04                 ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='9as6fl$gmq$1@ncc1701.cistron.net' \
    --to=miquels@cistron-office.nl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox