1#
2# Generic portion of the Broadcom wl driver makefile
3#
4# input: O_TARGET, CONFIG_WL_CONF and wl_suffix
5# output: obj-m, obj-y
6#
7# $Id: wl_generic.mk,v 1.1.1.1 2008/10/15 03:26:46 james26_jang Exp $
8#
9
10REBUILD_WL_MODULE=$(shell if [ -d "$(SRCBASE)/wl/sys" -a "$(REUSE_PREBUILT_WL)" != "1" ]; then echo 1; else echo 0; fi)
11
12# If source directory (src/wl/sys) exists and REUSE_PREBUILT_WL is undefined, 
13# then build inside $(SRCBASE)/wl/sys, otherwise use pre-builts
14ifeq ($(REBUILD_WL_MODULE),1)
15
16    # If source directory (src/wl/sys) exists, use sources to build objects
17    vpath %.c $(SRCBASE)/wl/sys $(SRCBASE)/shared $(SRCBASE)/bcmcrypto $(SRCBASE)/bcmsdio/sys
18    
19    # Get the source files and flags from the specified config file
20    # (Remove config's string quotes before trying to use the file)
21    ifeq ($(CONFIG_WL_CONF),)
22         $(error var_vlist($(VLIST)) var_config_wl_use($(shell env|grep CONFIG_WL_USE)))
23         $(error CONFIG_WL_CONF is undefined)
24    endif
25    
26    WLCONFFILE :=$(strip $(subst ",,$(CONFIG_WL_CONF))) 
27    WLCFGDIR   := $(SRCBASE)/wl/config
28    
29    # define OS flag to pick up wl osl file from wl.mk
30    WLLX=1
31    include $(WLCFGDIR)/$(WLCONFFILE)
32    include $(WLCFGDIR)/wl.mk
33    
34    ifeq ($(WLFILES),)
35         $(error WLFILES is undefined in $(WLCFGDIR)/$(WLCONFFILE))
36    endif
37    
38    ifeq ("$(CONFIG_WL_EMULATOR)","y") 
39         WLFILES += wl_bcm57emu.c
40    endif
41    
42    WL_SOURCE := $(WLFILES)
43    WL_DFLAGS := $(WLFLAGS)
44    WL_OBJS   := $(patsubst %.c,%.o,$(WL_SOURCE))
45    
46    # need -I. to pick up wlconf.h in build directory
47    
48    EXTRA_CFLAGS += -DDMA $(WL_DFLAGS) -I. -I$(SRCBASE)/wl/sys -finline-limit=2048 -Werror
49    
50    # obj-y is for linking to wl.o
51    export-objs :=
52    obj-y       := $(WL_OBJS)
53    obj-m       := $(O_TARGET)
54
55else # SRCBASE/wl/sys doesn't exist
56
57    # Otherwise, assume prebuilt object module(s) in src/wl/linux directory
58    prebuilt := wl_$(wl_suffix).o
59    obj-y    := $(SRCBASE)/wl/linux/$(prebuilt)
60    obj-m    := $(O_TARGET)
61
62endif
63
64include $(TOPDIR)/Rules.make
65
66