LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   CFLAGS vs EXTRA_CFLAGS, Ubuntu server 9.04 error while running "make install" (http://www.linuxquestions.org/questions/linux-general-1/cflags-vs-extra_cflags-ubuntu-server-9-04-error-while-running-make-install-734045/)

Invisible-Man 06-18-2009 08:38 PM

CFLAGS vs EXTRA_CFLAGS, Ubuntu server 9.04 error while running "make install"
 
While running "make install" on an Intel driver download, the following error occurred:

make -C /lib/modules/2.6.28-11-server/build SUBDIRS=/home/pete/drivers/e100-3.5.17/src modules
make[1]: Entering directory '/usr/src/linux-headers-2.6.28-11-server'
scripts/Makefile.build:46: *** CFLAGS was changed in "/home/operator/drivers/e100-3.5.17/src/Makefile". Fix it to use EXTRA_CFLAGS. Stop.
make[1]: *** [_module_/home/pete/drivers/e100-3.5.17/src] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-2.6.28-11-server'
make: *** [default] Error 2

"KBUILD_NOPEDANTIC=1 make" and "KBUILD_NOPEDANTIC=1 make install" both produced the same error as before.

Replacing CFLAGS with EXTRA_CFLAGS everywhere in Makefile produced the same errors as the unedited Makefile: unknown fields, implicit declaration of a function, INIT_WORK undeclared, etc. KBUILD_NOPEDANTIC didn't help with the edited Makefile either: same errors.

I've googled a lot and searched various forums, but nothing matches this exactly, and the solutions for the partial matches (EXTRA_CFLAGS vs CFLAGS_EXTRA) don't work. Any ideas, anyone?

GrapefruiTgirl 06-18-2009 09:28 PM

If there's a higher level Makefile, change the CFLAGS variable in there. I had the same crap happen with older Intel modem drivers, and fixing it in the uppermost makefile solved the problem (maybe fix it in BOTH Makefiles).

Don't be surprised however if this fixes that problem, but then the driver still won't build. For some reason, Intel's drivers don't seem IMHO to be very widely compatible with many different configurations of system.

Sasha

PS - Another option is to change the CFLAGS = to CFLAGS += so it will append to the existing CFLAGS environment variable. Try the first way first, though.

Good luck!

Invisible-Man 06-19-2009 06:45 AM

which Makefile?
 
A quick counts shows over 1100 Makefiles here and there throughout the filesystem, with over 100 in some /net directory or /networking directory or referencing "eth" or "e100". Can you suggest which one might be the higher level Makefile to edit? What would its location be? There are no other Makefiles in the unzipped Intel driver.

Unfortunately (for me, anyway) "CFLAGS +=" is already used throughout this Makefile. "CFLAGS =" is not used at all.

GrapefruiTgirl 06-19-2009 09:28 AM

How about this.. If this driver is a non-distro-specific source archive, and is reasonably un-large (like 2MB or so, or less), provide a link to it and I will download it and have a look.

It can't be an Ubuntu-specific driver, as I'm using Slackware. It's gotta be a generic sourcecode.

SVA

Invisible-Man 06-19-2009 09:55 AM

It's an Intel download for a Pro/100 VE, generic for Linux. About 60K.

e100-3.5.17.tar.gz

http://downloadcenter.intel.com/filt...s=39&submit=Go!

GrapefruiTgirl 06-19-2009 07:48 PM

Patch file.
 
OK, what a horrible little chunk of code that is :confused:

Anyhow, below is a patch file I made, which fixes the CFLAGS issue. Just copy this entire patch file here, and save it as filename patch inside the /src directory of the driver. Then while inside that /src directory, get a console window and type:

patch -i patch

And it should say 'Patching file Makefile' if all is well (I tried it several times, worked fine here).

Now, you can try to build the driver, but as I said, it still may not work and might need more adjustments.

To try building the driver, type:

make -j1

and see what happens.

For me, I got an error telling me that the e100.c on line 144 is looking for a file called /linux/config.h which it can't find. Because it cannot find this header file, the rest of the build fails. But maybe it will find the config.h file on your system, with any luck.. Might be that my kernel is too new, who knows...

Good luck, lemme know how it goes.

PATCH FILE BELOW:

Code:

--- ./e100-old/src/Makefile        2006-09-14 17:58:08.000000000 -0300
+++ ./e100-new/src/Makefile        2009-06-19 21:25:48.000000000 -0300
@@ -75,7 +75,7 @@ endif
 ifneq (,$(wildcard /boot/vmlinuz.version.h))
  VERSION_FILE := /boot/vmlinuz.version.h
  CONFIG_FILE  := /boot/vmlinuz.autoconf.h
-  KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \
+  KVER := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VERSION_FILE) | \
          grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
  ifeq ($(KVER),$(shell uname -r))
    # set up include path to override headers from kernel source
@@ -83,7 +83,7 @@ ifneq (,$(wildcard /boot/vmlinuz.version
    x:=$(shell mkdir -p include/linux)
    x:=$(shell cp /boot/vmlinuz.version.h include/linux/version.h)
    x:=$(shell cp /boot/vmlinuz.autoconf.h include/linux/autoconf.h)
-    CFLAGS += -I./include
+    EXTRA_CFLAGS += -I./include
  else
    ifneq (,$(wildcard $(KOBJ)/include/linux/utsrelease.h))
      VERSION_FILE := $(KOBJ)/include/linux/utsrelease.h
@@ -126,27 +126,27 @@ endif
 # some additional features are only built on Intel platforms
 ARCH := $(shell uname -m | sed 's/i.86/i386/')
 ifeq ($(ARCH),alpha)
-  CFLAGS += -ffixed-8 -mno-fp-regs
+  EXTRA_CFLAGS += -ffixed-8 -mno-fp-regs
 endif
 ifeq ($(ARCH),x86_64)
-  CFLAGS += -mcmodel=kernel -mno-red-zone
+  EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
 endif
 ifeq ($(ARCH),ppc)
-  CFLAGS += -msoft-float
+  EXTRA_CFLAGS += -msoft-float
 endif
 ifeq ($(ARCH),ppc64)
-  CFLAGS += -m64 -msoft-float
+  EXTRA_CFLAGS += -m64 -msoft-float
  LDFLAGS += -melf64ppc
 endif

 # standard flags for module builds
-CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
-CFLAGS += -I$(KSRC)/include -I.
-CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
+EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
+EXTRA_CFLAGS += -I$(KSRC)/include -I.
+EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
            echo "-DMODVERSIONS -DEXPORT_SYMTAB \
                  -include $(KSRC)/include/linux/modversions.h")

-CFLAGS += $(CFLAGS_EXTRA)
+EXTRA_CFLAGS += $(CFLAGS_EXTRA)
 #ifeq (,$(shell echo $(CFLAGS_EXTRA) | grep NAPI))
 #CFLAGS += -DE100_NO_NAPI
 #CFLAGS_EXTRA += -DE100_NO_NAPI
@@ -155,13 +155,13 @@ CFLAGS += $(CFLAGS_EXTRA)
 RHC := $(KSRC)/include/linux/rhconfig.h
 ifneq (,$(wildcard $(RHC)))
  # 7.3 typo in rhconfig.h
-  ifneq (,$(shell $(CC) $(CFLAGS) -E -dM $(RHC) | grep __module__bigmem))
-        CFLAGS += -D__module_bigmem
+  ifneq (,$(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(RHC) | grep __module__bigmem))
+        EXTRA_CFLAGS += -D__module_bigmem
  endif
 endif

 # get the kernel version - we use this to find the correct install path
-KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
+KVER := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
        awk '{ print $$3 }' | sed 's/\"//g')

 KKVER := $(shell echo $(KVER) | \
@@ -175,7 +175,7 @@ endif
  INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net/e100

 # look for SMP in config.h
-SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
+SMP := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(CONFIG_FILE) | \
          grep -w CONFIG_SMP | awk '{ print $$3 }')
 ifneq ($(SMP),1)
  SMP := 0
@@ -196,7 +196,7 @@ ifneq ($(SMP),$(shell uname -a | grep SM
 endif

 ifeq ($(SMP),1)
-  CFLAGS += -D__SMP__
+  EXTRA_CFLAGS += -D__SMP__
 endif

 ###########################################################################
@@ -217,7 +217,7 @@ ifneq ($(PATCHLEVEL),)
 EXTRA_CFLAGS += $(CFLAGS_EXTRA)
 obj-m += e100.o
 else
-default:
+default:
 ifeq ($(KOBJ),$(KSRC))
        make -C $(KSRC) SUBDIRS=$(shell pwd) modules
 else
@@ -236,12 +236,12 @@ MANFILE = $(TARGET:.o=.$(MANSECTION))

 # Get rid of compile warnings in kernel header files from SuSE
 ifneq (,$(wildcard /etc/SuSE-release))
-  CFLAGS += -Wno-sign-compare -fno-strict-aliasing
+  EXTRA_CFLAGS += -Wno-sign-compare -fno-strict-aliasing
 endif

 # Get rid of compile warnings in kernel header files from fedora
 ifneq (,$(wildcard /etc/fedora-release))
-  CFLAGS += -fno-strict-aliasing
+  EXTRA_CFLAGS += -fno-strict-aliasing
 endif

 .INTERMEDIATE: e100_tmp

Sasha :)

GrapefruiTgirl 06-19-2009 07:49 PM

Oh, and PS - if `make -j1' does work, then `make install` should also work.

Good luck,

Sasha

Invisible-Man 06-19-2009 08:09 PM

Wow. I'm substantially impressed.

I won't have access to the computer in question until Monday, but I'll give it a shot then and let you know how it worked.

Thanks a lot, really.

Pete

Invisible-Man 06-30-2009 07:28 AM

Sorry for the delay, but I had to put this project on the back burner for a week.

I created "patch" and put it in the /src directory.
I ran "patch -i patch"

Results:

(Stripping trailing CRs from patch.)
patching file Makefile
Hunk #7 FAILED at 217
patch unexpected end in middle of line
Hunk #8 succeeded at 236 with fuzz 1.
1 out of 8 hunks FAILED -- saving rejects to file Makefile.rej



I haven't tried running "make -j1" or "make install" until I take a look at the patch again.

I assume this is the offending Hunk from patch:

CODE SECTION START

@@ -217,7 +217,7 @@ ifneq ($(PATCHLEVEL),)
EXTRA_CFLAGS += $(CFLAGS_EXTRA)
obj-m += e100.o
else
-default:
+default:
ifeq ($(KOBJ),$(KSRC))
make -C $(KSRC) SUBDIRS=$(shell pwd) modules
else

CODE SECTION END

GrapefruiTgirl 06-30-2009 09:23 AM

Remember, the patch file needs to be in the exact same directory as the Makefile itself.

All that stuff about failed hunks, means it was likely not in the right location.

Try again :)

Sasha

Invisible-Man 06-30-2009 11:59 AM

Double checked the directory:

/home/pete/drivers/e100-3.5.17/src
(NOTE: My original question referenced /home/operator, not /home/pete)

# patch i patch

(Stripping trailing CRs from patch.)
patching file Makefile
Reversed (or previously applied patch detected! Assume -R/ [n]

[NOTE: Choosing NO at this point made all 8 hunks fail. Choosing YES produced the following results.]

Hunk #7 FAILED at 217
patch unexpectedly ends in middle of line
Hunk #8 succeeded at 236 with fuzz 1.
1 out of 8 hunks FAILED -- saving rejects to Makefile.rej



There's no e100.o to be found on the hard drive, if that helps.

GrapefruiTgirl 06-30-2009 12:18 PM

OK, I'm somewhat perplexed as to why the patch is not applying for you.

I am going to edit my post above, where I put the patch file for you, and re-paste the patch in there. Just in case that for some reason, either I pasted it in funny, or you copied it funny, and it's missing something.

I just ran the routine again on a freshly unpacked driver source, and the patch works cleanly for me.

Give me a few minutes for me to re-paste the patch above.

SVA

GrapefruiTgirl 06-30-2009 12:22 PM

OK, I re-pasted in the patch file above.
Copy it exactly as is, save as a text file called 'patch'

Extract the driver source afresh, and put the patch file in with the Makefile, then try 'patch -i patch'

It *should* work. It works here, so again, I'm really sorry if it doesn't patch cleanly for you; I can't explain it, but if it persists on not patching, I could post for you the actual patched Makefile itself. Let me know..

Sasha

Invisible-Man 07-02-2009 09:11 AM

Nope, same result.

"Hunk #7 FAILED at 217"

GrapefruiTgirl 07-02-2009 09:42 AM

Makefile
 
Here's the patched Makefile. Let me know how this works :)

Code:

################################################################################
#
# Intel PRO/100 Linux driver
# Copyright(c) 1999 - 2006 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# The full GNU General Public License is included in this distribution in
# the file called "COPYING".
#
# Contact Information:
# Linux NICS <linux.nics@intel.com>
# e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
# Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
#
################################################################################


###########################################################################
# Driver files

# core driver files
CFILES = e100.c
HFILES = kcompat.h
ifeq (,$(BUILD_KERNEL))
BUILD_KERNEL=$(shell uname -r)
endif

###########################################################################
# Environment tests

# Kernel Search Path
# All the places we look for kernel source
KSP :=  /lib/modules/$(BUILD_KERNEL)/build \
        /lib/modules/$(BUILD_KERNEL)/source \
        /usr/src/linux-$(BUILD_KERNEL) \
        /usr/src/linux-$($(BUILD_KERNEL) | sed 's/-.*//') \
        /usr/src/kernel-headers-$(BUILD_KERNEL) \
        /usr/src/kernel-source-$(BUILD_KERNEL) \
        /usr/src/linux-$($(BUILD_KERNEL) | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
        /usr/src/linux

# prune the list down to only values that exist
# and have an include/linux sub-directory
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))

# we will use this first valid entry in the search path
ifeq (,$(KSRC))
  KSRC := $(firstword $(KSP))
endif

ifeq (,$(KSRC))
  $(error Linux kernel source not found)
else
ifeq (/lib/modules/$(shell uname -r)/source, $(KSRC))
  KOBJ :=  /lib/modules/$(shell uname -r)/build
else
  KOBJ :=  $(KSRC)
endif
endif

# check for version.h and autoconf.h for running kernel in /boot (SUSE)
ifneq (,$(wildcard /boot/vmlinuz.version.h))
  VERSION_FILE := /boot/vmlinuz.version.h
  CONFIG_FILE  := /boot/vmlinuz.autoconf.h
  KVER := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VERSION_FILE) | \
          grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
  ifeq ($(KVER),$(shell uname -r))
    # set up include path to override headers from kernel source
    x:=$(shell rm -rf include)
    x:=$(shell mkdir -p include/linux)
    x:=$(shell cp /boot/vmlinuz.version.h include/linux/version.h)
    x:=$(shell cp /boot/vmlinuz.autoconf.h include/linux/autoconf.h)
    EXTRA_CFLAGS += -I./include
  else
    ifneq (,$(wildcard $(KOBJ)/include/linux/utsrelease.h))
      VERSION_FILE := $(KOBJ)/include/linux/utsrelease.h
    else
      VERSION_FILE := $(KOBJ)/include/linux/version.h
    endif
    CONFIG_FILE  := $(KSRC)/include/linux/autoconf.h
  endif
else
  ifneq (,$(wildcard $(KOBJ)/include/linux/utsrelease.h))
    VERSION_FILE := $(KOBJ)/include/linux/utsrelease.h
  else
    VERSION_FILE := $(KOBJ)/include/linux/version.h
  endif
  CONFIG_FILE  := $(KSRC)/include/linux/autoconf.h
endif

ifeq (,$(wildcard $(VERSION_FILE)))
  $(error Linux kernel source not configured - missing version.h)
endif

ifeq (,$(wildcard $(CONFIG_FILE)))
  $(error Linux kernel source not configured - missing autoconf.h)
endif

# pick a compiler
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
  CC := kgcc gcc cc
else
  CC := gcc cc
endif
test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
ifeq (,$(CC))
  $(error Compiler not found)
endif

# we need to know what platform the driver is being built on
# some additional features are only built on Intel platforms
ARCH := $(shell uname -m | sed 's/i.86/i386/')
ifeq ($(ARCH),alpha)
  EXTRA_CFLAGS += -ffixed-8 -mno-fp-regs
endif
ifeq ($(ARCH),x86_64)
  EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
endif
ifeq ($(ARCH),ppc)
  EXTRA_CFLAGS += -msoft-float
endif
ifeq ($(ARCH),ppc64)
  EXTRA_CFLAGS += -m64 -msoft-float
  LDFLAGS += -melf64ppc
endif

# standard flags for module builds
EXTRA_CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
EXTRA_CFLAGS += -I$(KSRC)/include -I.
EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
            echo "-DMODVERSIONS -DEXPORT_SYMTAB \
                  -include $(KSRC)/include/linux/modversions.h")

EXTRA_CFLAGS += $(CFLAGS_EXTRA)
#ifeq (,$(shell echo $(CFLAGS_EXTRA) | grep NAPI))
#CFLAGS += -DE100_NO_NAPI
#CFLAGS_EXTRA += -DE100_NO_NAPI
#endif

RHC := $(KSRC)/include/linux/rhconfig.h
ifneq (,$(wildcard $(RHC)))
  # 7.3 typo in rhconfig.h
  ifneq (,$(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(RHC) | grep __module__bigmem))
        EXTRA_CFLAGS += -D__module_bigmem
  endif
endif

# get the kernel version - we use this to find the correct install path
KVER := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
        awk '{ print $$3 }' | sed 's/\"//g')

KKVER := $(shell echo $(KVER) | \
        awk '{ if ($$0 ~ /2\.[4-9]\./) print "1"; else print "0"}')
ifeq ($(KKVER), 0)
  $(error *** Aborting the build. \
          *** This driver is not supported on kernel versions older than 2.4.0)
endif

# set the install path
  INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net/e100

# look for SMP in config.h
SMP := $(shell $(CC) $(EXTRA_CFLAGS) -E -dM $(CONFIG_FILE) | \
        grep -w CONFIG_SMP | awk '{ print $$3 }')
ifneq ($(SMP),1)
  SMP := 0
endif

ifneq ($(SMP),$(shell uname -a | grep SMP > /dev/null 2>&1 && echo 1 || echo 0))
  $(warning ***)
  ifeq ($(SMP),1)
    $(warning *** Warning: kernel source configuration (SMP))
    $(warning *** does not match running kernel (UP))
  else
    $(warning *** Warning: kernel source configuration (UP))
    $(warning *** does not match running kernel (SMP))
  endif
  $(warning *** Continuing with build,)
  $(warning *** resulting driver may not be what you want)
  $(warning ***)
endif

ifeq ($(SMP),1)
  EXTRA_CFLAGS += -D__SMP__
endif

###########################################################################
# 2.4.x & 2.6.x Specific rules

K_VERSION:=$(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')

ifeq ($(K_VERSION), 2.6)

# Makefile for 2.6.x kernel
TARGET = e100.ko

# man page
MANSECTION = 7
MANFILE = $(TARGET:.ko=.$(MANSECTION))

ifneq ($(PATCHLEVEL),)
EXTRA_CFLAGS += $(CFLAGS_EXTRA)
obj-m += e100.o
else
default:
ifeq ($(KOBJ),$(KSRC))
        make -C $(KSRC) SUBDIRS=$(shell pwd) modules
else
        make -C $(KSRC) O=$(KOBJ) SUBDIRS=$(shell pwd) modules
endif
endif

else # ifeq ($(K_VERSION),2.6)

# Makefile for 2.4.x kernel
TARGET = e100.o

# man page
MANSECTION = 7
MANFILE = $(TARGET:.o=.$(MANSECTION))

# Get rid of compile warnings in kernel header files from SuSE
ifneq (,$(wildcard /etc/SuSE-release))
  EXTRA_CFLAGS += -Wno-sign-compare -fno-strict-aliasing
endif

# Get rid of compile warnings in kernel header files from fedora
ifneq (,$(wildcard /etc/fedora-release))
  EXTRA_CFLAGS += -fno-strict-aliasing
endif

.INTERMEDIATE: e100_tmp
.SILENT: e100_tmp
e100_tmp: $(CFILES:.c=.o)
        echo; echo
        echo "**************************************************"
        echo "** $(TARGET) built for $(KVER)"
        echo -n "** SMP              "
        if [ "$(SMP)" = "1" ]; \
                then echo "Enabled"; else echo "Disabled"; fi
        echo "**************************************************"
        echo

$(CFILES:.c=.o): $(HFILES) Makefile
default:
        make

endif # ifeq ($(K_VERSION),2.6)

ifeq (,$(MANDIR))
  # find the best place to install the man page
  MANPATH := $(shell (manpath 2>/dev/null || echo $MANPATH) | sed 's/:/ /g')
  ifneq (,$(MANPATH))
    # test based on inclusion in MANPATH
    test_dir = $(findstring $(dir), $(MANPATH))
  else
    # no MANPATH, test based on directory existence
    test_dir = $(shell [ -e $(dir) ] && echo $(dir))
  endif
  # our preferred install path
  # should /usr/local/man be in here ?
  MANDIR := /usr/share/man /usr/man
  MANDIR := $(foreach dir, $(MANDIR), $(test_dir))
  MANDIR := $(firstword $(MANDIR))
endif
ifeq (,$(MANDIR))
  # fallback to /usr/man
  MANDIR := /usr/man
endif

# depmod version for rpm builds
DEPVER := $(shell /sbin/depmod -V 2>/dev/null | \
          awk 'BEGIN {FS="."} NR==1 {print $$2}')

###########################################################################
# Build rules

$(MANFILE).gz: ../$(MANFILE)
        gzip -c $< > $@

install: default $(MANFILE).gz
        # remove all old versions of the driver
        find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET) -exec rm -f {} \; || true
        find $(INSTALL_MOD_PATH)/lib/modules/$(KVER) -name $(TARGET).gz -exec rm -f {} \; || true
        install -D -m 644 $(TARGET) $(INSTALL_MOD_PATH)$(INSTDIR)/$(TARGET)
ifeq (,$(INSTALL_MOD_PATH))
        /sbin/depmod -a || true
else
  ifeq ($(DEPVER),1 )
        /sbin/depmod -r $(INSTALL_MOD_PATH) -a || true
  else
        /sbin/depmod -b $(INSTALL_MOD_PATH) -a -n $(KVERSION) > /dev/null || true
  endif
endif
        install -D -m 644 $(MANFILE).gz $(INSTALL_MOD_PATH)$(MANDIR)/man$(MANSECTION)/$(MANFILE).gz
        man -c -P'cat > /dev/null' $(MANFILE:.$(MANSECTION)=) || true

uninstall:
        if [ -e $(INSTDIR)/$(TARGET) ] ; then \
            rm -f $(INSTDIR)/$(TARGET) ; \
        fi
        /sbin/depmod -a
        if [ -e $(MANDIR)/man$(MANSECTION)/$(MANFILE).gz ] ; then \
                rm -f $(MANDIR)/man$(MANSECTION)/$(MANFILE).gz ; \
        fi

.PHONY: clean install

clean:
        rm -rf $(TARGET) $(TARGET:.ko=.o) $(TARGET:.ko=.mod.c) $(TARGET:.ko=.mod.o) $(CFILES:.c=.o) $(MANFILE).gz .*cmd .tmp_versions



All times are GMT -5. The time now is 07:32 AM.