and really add upstream source :-)
[linux-2.6.git] / drivers / net / ip1000a / Makefile.orig
1 #
2 # Makefile for IC Plus Ethernet Adapter driver for Linux
3 # Copyright (c) 2004 by IC Plus Corporation.
4 #
5 #
6 OBJS    = ipg_main.o
7 TARGET  = ipg.o
8 MAPPING_MODE= -DUSE_IO_OPS
9 #MAPPING_MODE= -DUSE_IO_OPS -DJUMBO_FRAME -DJUMBO_FRAME_SIZE_4K
10
11 KernelVersion            := $(shell uname -r)
12 KernelBuildDir           := /lib/modules/$(KernelVersion)/build
13 kernelMisc               := /lib/modules/$(KernelVersion)/kernel/drivers/net/
14 kernelExtension          := $(shell echo $(KernelVersion) | sed -ne 's/^2\.[567]\..*/k/p')o
15 kernelFlag26               := kernel2$(shell echo $(KernelVersion) | sed -ne 's/^2\.[6]\..*/6/p')x
16
17
18 #======================Makefile for kernel 2.2.x and 2.4.x======================
19 ifneq ($(kernelFlag26),kernel26x)
20 CC      = gcc
21 CFLAGS = -D__KERNEL__ -DMODULE -O -Wall -Wstrict-prototypes -I$(INCLUDEDIR)
22 EXTRA_CFLAGS := $(MAPPING_MODE) 
23 EXTRA_CFLAGS := $(EXTRA_CFLAGS) -D_COMPAT_WITH_OLD_KERNEL
24
25
26 KernelSrcPath :=  /lib/modules/$(shell uname -r)/build \
27         /usr/src/linux-$(shell uname -r) \
28         /usr/src/linux-$(shell uname -r | sed 's/-.*//') \
29         /usr/src/kernel-headers-$(shell uname -r) \
30         /usr/src/kernel-source-$(shell uname -r) \
31         /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
32         /usr/src/linux
33 FindDir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
34 KernelSrcPath := $(foreach dir, $(KernelSrcPath), $(FindDir))
35 KernelSrc := $(firstword $(KernelSrcPath))
36
37 # Support Linux software VLAN
38 #EXTRA_CFLAGS := $(EXTRA_CFLAGS) -DCONFIG_VLAN_8021Q
39
40 #EXTRA_CFLAGS := $(EXTRA_CFLAGS) -DEXTRA_STATS
41 #DEBUG_FLAGS = -O -g -DALTA_DEBUG
42 K_VER=$(shell uname -r)
43 INCLUDEDIR=$(shell if [ -e /usr/src/linux-$(K_VER)/include ]; \
44         then echo "/usr/src/linux-$(K_VER)/include"; \
45         elif [ -e /usr/src/linux-2.4/include ]; \
46         then echo "/usr/src/linux-2.4/include"; \
47         elif [ -e /usr/src/linux/include ]; \
48         then echo "/usr/src/linux/include"; \
49         else echo "/usr/include"; fi)
50 #
51 # Old kernel need to configure modversions.h
52 #
53 #EXTRA_CFLAGS := $(EXTRA_CFLAGS) \
54 #       $(shell if [ -e $(INCLUDEDIR)/linux/modversions.h ]; \
55 #       then echo -DCONFIG_MODVERSIONS; fi)
56
57 CFLAGS+=$(shell [ -f $(KernelSrc)/include/linux/modversions.h ] && \
58                 echo "-DMODVERSIONS -include $(KernelSrc)/include/linux/modversions.h")
59                 
60 $(TARGET):      $(OBJS)
61                 $(LD) -r -o $@ $(OBJS)
62 #
63 # Dependency to create object file.
64 #
65 all:    $(TARGET)
66 #
67 #
68 # Common make rules
69
70 %.o:%.c
71         $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(DEBUG_FLAGS) -c -o $@ $< 
72 endif
73
74
75 #===========================Makefile for kernel 2.6.x===========================
76 ifeq ($(kernelFlag26),kernel26x)
77 EXTRA_CFLAGS+=$(MAPPING_MODE)
78
79 all:
80         $(MAKE) -C $(KernelBuildDir) SUBDIRS=$(PWD) modules 
81         
82 install:
83         install -m 644 -c ipg.$(kernelExtension) $(kernelMisc)
84
85 ipg-objs:=$(OBJS)
86 obj-m+=$(TARGET)
87 endif
88
89 #===========================Makefile common section============================
90 # Delete existing object file 
91 #
92 clean:
93         rm -f *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags