| John W. Linville | f222313 | 2006-01-23 16:59:58 -0500 | [diff] [blame^] | 1 | # Makefile for bcm43xx driver | 
|  | 2 |  | 
|  | 3 | VERSION		:= 0.0.1 | 
|  | 4 | RELEASE_NAME	:= bcm43xx-$(VERSION) | 
|  | 5 |  | 
|  | 6 | # Optional path, where the SoftMAC subsystem is located. | 
|  | 7 | # You may set SOFTMAC_DIR in your bashrc, for example. | 
|  | 8 | SOFTMAC_DIR	?= | 
|  | 9 |  | 
|  | 10 | KVER		:= $(shell uname -r) | 
|  | 11 | KDIR		?= /lib/modules/$(KVER)/build | 
|  | 12 | PWD		:= $(shell pwd) | 
|  | 13 | MODPATH		:= $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/net/bcm43xx | 
|  | 14 |  | 
|  | 15 | # Comment/uncomment to enable/disable debugging | 
|  | 16 | DEBUG = y | 
|  | 17 |  | 
|  | 18 |  | 
|  | 19 | ifeq ($(DEBUG),y) | 
|  | 20 | DEBUGFS_OBJ = bcm43xx_debugfs.o | 
|  | 21 | CFLAGS += -O2 -DCONFIG_BCM43XX_DEBUG | 
|  | 22 | else | 
|  | 23 | DEBUGFS_OBJ = | 
|  | 24 | CFLAGS += -O2 | 
|  | 25 | endif | 
|  | 26 |  | 
|  | 27 | CFLAGS += -DBCM43xx_VERSION=$(VERSION) -I/lib/modules/$(KVER)/include | 
|  | 28 | ifneq ($(SOFTMAC_DIR),) | 
|  | 29 | CPPFLAGS := -I$(SOFTMAC_DIR) $(CPPFLAGS) | 
|  | 30 | endif | 
|  | 31 |  | 
|  | 32 | ifneq ($(KERNELRELEASE),) | 
|  | 33 | # call from kernel build system | 
|  | 34 |  | 
|  | 35 | obj-m := bcm43xx.o | 
|  | 36 | bcm43xx-objs := bcm43xx_main.o bcm43xx_dma.o $(DEBUGFS_OBJ) \ | 
|  | 37 | bcm43xx_radio.o bcm43xx_phy.o \ | 
|  | 38 | bcm43xx_power.o bcm43xx_wx.o \ | 
|  | 39 | bcm43xx_pio.o bcm43xx_ilt.o \ | 
|  | 40 | bcm43xx_leds.o | 
|  | 41 |  | 
|  | 42 | else | 
|  | 43 |  | 
|  | 44 | default: modules | 
|  | 45 |  | 
|  | 46 | modules: | 
|  | 47 | $(MAKE) -C $(KDIR) M=$(PWD) modules | 
|  | 48 |  | 
|  | 49 | install: bcm43xx.ko | 
|  | 50 | install -d $(MODPATH) | 
|  | 51 | install -m 644 -c bcm43xx.ko $(MODPATH) | 
|  | 52 | /sbin/depmod -a | 
|  | 53 |  | 
|  | 54 | uninstall: | 
|  | 55 | rm -rf $(MODPATH) | 
|  | 56 | /sbin/depmod -a | 
|  | 57 |  | 
|  | 58 | endif | 
|  | 59 |  | 
|  | 60 | clean: | 
|  | 61 | find . \( -name '*.ko' -o -name '*.o' -o -name '.tmp_versions' -o -name '*~' -o -name '.*.cmd' \ | 
|  | 62 | -o -name '*.mod.c' -o -name '*.tar.bz2' -o -name '*.rej' -o -name '*.orig' \)\ | 
|  | 63 | -print | xargs rm -Rf | 
|  | 64 |  | 
|  | 65 | depend .depend dep: | 
|  | 66 | $(CC) $(CFLAGS) -M *.c > .depend | 
|  | 67 |  | 
|  | 68 | ifeq (.depend,$(wildcard .depend)) | 
|  | 69 | include .depend | 
|  | 70 | endif | 
|  | 71 |  | 
|  | 72 | DISTFILES =  $(shell find . \( -not -name '.' \) -print | grep -v "\.tar\.bz2" | grep -v "\/\." ) | 
|  | 73 | DISTDIR = $(RELEASE_NAME) | 
|  | 74 |  | 
|  | 75 | release: clean | 
|  | 76 | @rm -rf $(DISTDIR) | 
|  | 77 | @mkdir $(DISTDIR) | 
|  | 78 | @chmod 777 $(DISTDIR) | 
|  | 79 | @for file in $(DISTFILES); do                   \ | 
|  | 80 | if test -d $$file; then                 \ | 
|  | 81 | mkdir $(DISTDIR)/$$file;        \ | 
|  | 82 | else                                    \ | 
|  | 83 | cp -p $$file $(DISTDIR)/$$file; \ | 
|  | 84 | fi;                                     \ | 
|  | 85 | done | 
|  | 86 | @tar -c $(DISTDIR) | bzip2 -9 > $(RELEASE_NAME).tar.bz2 | 
|  | 87 | @rm -rf $(DISTDIR) |