mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Axel Weiss <aweiss@informatik.hu-berlin.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: compiling external modules
Date: Fri, 16 Apr 2004 17:41:07 +0200	[thread overview]
Message-ID: <200404161741.07824.aweiss@informatik.hu-berlin.de> (raw)

On Thursday 15 April 2004 23:59, Sam Ravnborg wrote:
> The general feedback is that it looks like you have
> made it less simple than it ought to be.
>
> You should also consider that you end up with files
> that does not look like ordinary kbuild makefiles.

Hi, Sam,

seems you don't like my style putting things into variables ;)

Here's my latest work, I have tested this Makefile with vanilla-2.6.5, -2.6.6-rc1 and  suse-2.4.21-199 (SuSE 9.0).

Regards,
Axel

#/***************************************************************************
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU General Public License as published by  *
# *   the Free Software Foundation; either version 2 of the License, or     *
# *   (at your option) any later version.                                   *
# *                                                                         *
# ***************************************************************************/
#
#  Template Makefile for external module compilation
#
#  (C) 2004 by Axel Weiss (aweiss@informatik.hu-berlin.de)
#

KDIR          := /lib/modules/$(shell uname -r)/build
PWD           := $(shell pwd)

K_MAJOR := $(shell uname -r | sed -e "s/\..*//")
K_MINOR := $(shell uname -r | sed -e "s/$(K_MAJOR)\.//" -e "s/\..*//")
K_REV   := $(shell uname -r | sed -e "s/$(K_MAJOR)\.$(K_MINOR)\.//" -e "s/-.*//")

NEED_EXPORT := $(strip $(shell [[ "$(K_MAJOR)" = "2" \
                               && "$(K_MINOR)" < "7" \
                               && "$(K_REV)"   < "6" ]] && echo yes || echo no))

NEED_CLEAN  := $(strip $(shell [[ "$(K_MAJOR)" = "2" \
                               && "$(K_MINOR)" < "7" \
                               && "$(K_REV)"   < "6" ]] && echo yes))

.PHONY: all clean


ifneq ($(KERNELRELEASE),)

obj-m         := <mod-name>.o
<mod-name>-objs := <mod-object-list>
ifeq ($(NEED_EXPORT),yes)
export-objs := <mod-export-list>
endif # ifeq ($(NEED_EXPORT),yes)

-include $(KDIR)/Rules.make

<mod-name>.o: $(<mod-name>-objs)
	$(Q)$(LD) $(LD_RFLAG) -r -o $@ $(<mod-name>-objs)


else  # ifneq ($(KERNELRELEASE),)

all:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
ifeq ($(NEED_CLEAN),yes)
	rm -f <mod-name>.ko *.o .*.cmd .*.o.flags <mod-name>.mod.c $(KDIR)/.tmp_versions/<mod-name>.mod
else
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
endif # ifeq ($(NEED_CLEAN),yes)
endif # ifneq ($(KERNELRELEASE),)



             reply	other threads:[~2004-04-16 15:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-16 15:41 Axel Weiss [this message]
2004-04-16 16:54 ` Sam Ravnborg
2004-04-16 20:09   ` Axel Weiss
2004-04-16 20:51     ` Sam Ravnborg
2004-04-16 21:04       ` Sam Ravnborg
2004-04-16 23:24       ` Axel Weiss
  -- strict thread matches above, loose matches on Subject: below --
2004-04-15 21:05 Axel Weiss
2004-04-15 21:59 ` Sam Ravnborg
2004-04-16  7:22   ` Duncan Sands
2004-04-16 12:06   ` Axel Weiss
2004-04-16 12:34     ` Axel Weiss
2004-04-16 16:55     ` Sam Ravnborg

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=200404161741.07824.aweiss@informatik.hu-berlin.de \
    --to=aweiss@informatik.hu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.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

all inboxes | Powered by JetHome®