upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / net / wireless / bcm4330 / src / Makerules
1 #
2 #  Top level Makerules
3 #  it uses Makerules.env for build env vars and optional branding.inc
4 #
5 #  Copyright (C) 1999-2011, Broadcom Corporation
6 #  
7 #          Unless you and Broadcom execute a separate written software license
8 #  agreement governing use of this software, this software is licensed to you
9 #  under the terms of the GNU General Public License version 2 (the "GPL"),
10 #  available at http://www.broadcom.com/licenses/GPLv2.php, with the
11 #  following added to such license:
12 #  
13 #       As a special exception, the copyright holders of this software give you
14 #  permission to link this software with independent modules, and to copy and
15 #  distribute the resulting executable under terms of your choice, provided that
16 #  you also meet, for each linked independent module, the terms and conditions of
17 #  the license of that module.  An independent module is a module which is not
18 #  derived from this software.  The special exception does not apply to any
19 #  modifications of the software.
20 #  
21 #       Notwithstanding the above, under no circumstances may you combine this
22 #  software in any way with any other Broadcom software provided under a license
23 #  other than the GPL, without Broadcom's express prior written consent.
24 #
25 # $Id: Makerules,v 2.78.42.1 2010-05-11 17:55:55 $
26
27 # This is the TOP level makefile rules, which is used by many makefiles.
28 # Please be cautious on changes, especially compatibilities.
29 #   e.g. new gcc compile option should be protected with version check 
30 #        or "check_gcc" trick
31
32 # first rule (default)
33 all:
34
35 # SRCBASE should be set by the Makefile that includes this.
36 ifndef  SRCBASE
37         SRCBASE = .
38 endif
39
40 # Set up the build environment variables
41 include ${SRCBASE}/Makerules.env
42
43 # Define space to be a single space character. Using " " gets the quotes
44 # as well, which we don't want.
45 empty :=
46 space := $(empty) $(empty)
47
48 ifeq ($(HOSTOS), Windows_NT)
49
50 # force use of bash, otherwise you will get the broken sh.exe.
51 SHELL=bash
52
53 endif
54
55 #
56 # Setup make variables depending on target
57 #
58
59 ifeq ($(TARGETOS), unix)
60
61         # The environment for native unix builds
62
63         EXEEXT  = 
64         OBJEXT  = .o
65         GCINCS  = -I$(SRCBASE)/include
66         GCDEFS  = -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) -DTARGETARCH_$(TARGETARCH)
67
68         ifeq ($(TARGETARCH), x86_mmx)
69                 GCDEFS  := $(GCDEFS) -D_X86_ -D_MMX_
70         endif
71         ifeq ($(TARGETARCH), x86)
72                 GCDEFS  := $(GCDEFS) -D_X86_
73         endif
74         ifeq ($(TARGETARCH), mips)
75                 GCDEFS  := $(GCDEFS) -D_MIPS_
76         endif
77         ifeq ($(TARGETARCH), mips_be)
78                 GCDEFS  := $(GCDEFS) -D_MIPS_ -DIL_BIGENDIAN
79         endif
80         ifeq ($(TARGETARCH), arm)
81                 GCDEFS  := $(GCDEFS) -D_ARM_ -DIL_BIGENDIAN
82         endif
83         ifeq ($(TARGETARCH), arm_le)
84                 GCDEFS  := $(GCDEFS) -D_ARM_
85         endif
86         ifeq ($(TARGETARCH), arm_android)
87                 GCDEFS  := $(GCDEFS) -D_ARM_
88         endif
89
90         ifeq ($(TARGETENV), freebsd)
91                 GCINCS  := $(GCINCS) -I/usr/local/include
92         endif
93         ifeq ($(TARGETENV), sun4)
94                 GCDEFS  := $(GCDEFS) -D_SPARC_
95         endif
96         ifeq ($(TARGETENV), macos)
97                 MACOS_VER := $(shell sw_vers -productVersion)
98
99                 ifneq (,$(findstring 10.5,$(MACOS_VER)))
100                         SDK=/Developer/SDKs/MacOSX10.5.sdk
101                 else
102                 ifneq (,$(findstring 10.6,$(MACOS_VER)))
103                         SDK=/Developer/SDKs/MacOSX10.6.sdk
104                 else
105                         SDK=/Developer/SDKs/MacOSX10.4u.sdk
106                 endif
107                 endif
108
109                 GCDEFS  := $(GCDEFS) -DMACOSX
110                 GCDEFS  := $(GCDEFS) -pipe -fpascal-strings -fasm-blocks -fmessage-length=0
111                 GCDEFS  := $(GCDEFS) -fvisibility=hidden -isysroot $(SDK)
112
113                 ifeq ($(TARGETARCH), PPC)
114                         GCDEFS  := $(GCDEFS) -arch ppc -mtune=G4
115                         GLDFLAGS = -arch ppc -Wl,-syslibroot,$(SDK)
116                 endif
117                 ifeq ($(TARGETARCH), x86)
118                         GCDEFS  := $(GCDEFS) -arch i386
119                         GLDFLAGS = -arch i386 -Wl,-syslibroot,$(SDK)
120                 endif
121         endif
122
123         GCOPTS  =
124         GCFLAGS = -g -Wall
125
126         CC_TARGET       =-o $@
127         LINK_TARGET     =-o $@
128
129         ifeq ($(TARGETENV), linuxmips)
130                 TARGET_PREFIX = mipsel-linux-
131         else
132         ifeq ($(TARGETENV), linuxmips_be)
133                 TARGET_PREFIX = mips-linux-
134         else
135         ifeq ($(TARGETENV), linuxarm)
136                 TARGET_PREFIX = armeb-linux-
137         else
138         ifeq ($(TARGETENV), linuxarm_le)
139                 TARGET_PREFIX = arm-linux-
140         else
141         ifeq ($(TARGETENV), android)
142                 TARGET_PREFIX = arm-eabi-
143                 GCFLAGS += -Dlinux
144                 GCFLAGS += -I/projects/hnd/tools/linux/hndtools-arm-eabi-4.2.1/android-ndk-r3/build/platforms/android-3/arch-arm/usr/include
145 #               GCFLAGS += -I/projects/hnd/tools/linux/hndtools-arm-eabi-4.2.1/arm-eabi/include/bionic/libc/include
146 #               GCFLAGS += -I/projects/hnd/tools/linux/hndtools-arm-eabi-4.2.1/arm-eabi/include/bionic/libc/arch-arm/include/
147                 GCFLAGS += -I/tools/linux/src/linux-2.6.25-01843-gfea26b0/include/
148         else
149                 TARGET_PREFIX =
150         endif
151         endif
152         endif
153         endif
154         endif
155
156         CC = $(TARGET_PREFIX)gcc
157         AS = $(TARGET_PREFIX)as
158         LD = $(TARGET_PREFIX)ld
159         AR = $(TARGET_PREFIX)ar
160
161         INSTALL = install -c
162
163         TCFLAGS =
164
165         ifeq ($(TARGETENV), freebsd)
166                 GLDFLAGS = -static
167         endif
168         ifeq ($(TARGETENV), linuxarm)
169                 GLDFLAGS = -static
170         endif
171         ifeq ($(TARGETENV), linuxarm_le)
172                 GLDFLAGS = -static
173         endif
174         ifeq ($(TARGETENV), android)
175                 GLDFLAGS = -static
176         endif
177
178         GLDLIBS = -lgcc
179
180 endif   # $(TARGETOS) == unix
181
182 ifeq ($(TARGETOS), Windows_NT)
183
184         # The environment for windows builds
185
186         EXEEXT = .exe
187
188         ifeq ($(TARGETENV), win32)
189                 # standard win32 using MS compiler
190                 OBJEXT  = .obj
191                 GCINCS  = /I$(SRCBASE)/include
192                 GCDEFS  = /DTARGETENV_$(TARGETENV) /DTARGETOS_$(TARGETOS) \
193                         /DTARGETARCH_$(TARGETARCH) /D_X86_
194                 ifeq ($(TARGETARCH), x86_mmx)
195                         GCDEFS += /D_MMX_
196                 endif
197                 GCOPTS  = /nologo
198                 GCFLAGS = /GM /W3 /Z7
199
200                 CC_TARGET       =-Fo$@
201                 LINK_TARGET     =-out:$@
202
203                 CC = cl
204                 AS = cl
205                 LD = cl
206
207                 TCFLAGS =
208                 GLDFLAGS = /nologo /link /nologo /INCREMENTAL:NO
209
210                 GLDLIBS =
211         else
212                 # cygwin32 based environment
213                 OBJEXT  = .o
214                 GCINCS  = -I$(SRCBASE)/include
215                 GCDEFS  = -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) \
216                         -DTARGETARCH_$(TARGETARCH) -D_X86_
217                 ifeq ($(TARGETARCH), x86_mmx)
218                         GCDEFS += -D_MMX_
219                 endif
220                 GCOPTS  =
221                 GCFLAGS = -g -Wall
222
223                 CC_TARGET       =-o $@
224                 LINK_TARGET     =-o $@
225
226                 CC = gcc
227                 AS = gcc
228                 LD = gcc
229                 INSTALL = install -c
230
231                 TCFLAGS =
232                 GLDFLAGS =
233
234                 GLDLIBS = -liberty -lgcc
235         endif
236
237         # Tools common to cygwin/win32
238
239         INSTALL = install -c
240         BUILD = build -ceZ
241
242         # RELEASE_TARGET is a the directory under RELEASE_DIR where
243         # target dependant files go. It is composed of the OS and
244         # the CPU, some examples are: winnt40/i386, win98 ...
245         #
246         # NEEDSWORK: For now only NT 4.0 stuff uses it.
247         ifneq ($(findstring $(TARGETPLATFORM), "Wdm wdm"), )
248                 RELEASE_TARGET = wdm/i386
249         else
250                 RELEASE_TARGET = winnt40/i386
251         endif
252
253         # RELEASE_TOOLS_DIR is a the directory under RELEASE_DIR where
254         # common tools go.
255         # For compatability with previous installs &test scripts, old
256         # tools still go in "yosemite".
257         RELEASE_YOS_DIR = yosemite
258         RELEASE_TOOLS_DIR = tools
259
260 endif   # $(TARGETOS) == Windows_NT
261
262 ifeq ($(TARGETOS), vxWorks)
263         WIND_REGISTRY = sol
264         ifndef WIND_BASE
265                 ifeq ($(HOSTOS), unix)
266                         WIND_BASE = /dfs/tools/vxWorks
267                 else
268                         WIND_BASE = z:/tools/vxWorks
269                 endif
270         endif
271         include $(WIND_BASE)/target/h/make/defs.default
272
273         ifeq ($(HOSTENV), Windows_NT)
274                 WIND_HOST_TYPE = x86-win32
275         else
276                 ifeq ($(HOSTENV), sun4)
277                         WIND_HOST_TYPE = sun4-solaris2
278                 else
279                         WIND_HOST_TYPE = i386-freebsd
280                 endif
281         endif
282
283         ifeq ($(TARGETENV), vxsim)
284                 CPU = SIMSPARCSOLARIS
285         else
286                 ifeq ($(TARGETENV), vx386)
287                         CPU = i386
288                 else
289                         CPU = R4650
290                         VXFLAGS  = -DCPU_VAR=$(CPU)
291                 endif
292         endif
293
294         include $(WIND_BASE)/target/h/make/make.$(CPU)$(TOOL)
295         include $(WIND_BASE)/target/h/make/defs.$(WIND_HOST_TYPE)
296
297         GCINCS  = -I$(WIND_BASE)/target/h -I$(SRCBASE)/include
298         GCDEFS  = $(DEFINE_CC) -DCPU=$(CPU) -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) -DTARGETARCH_$(TARGETARCH)
299         GCOPTS  = -g -O2
300         GCFLAGS = -Wall $(CC_ARCH_SPEC)
301         LDFLAGS = $(GLDFLAGS) $(LLDFLAGS)
302         GLDLIBS = $(LIBS)
303
304         WIND_BIN = $(WIND_BASE)/host/$(WIND_HOST_TYPE)/bin
305
306         AR      := $(WIND_BIN)/$(AR)
307         AS      := $(WIND_BIN)/$(AS)
308         BINHEX  := $(WIND_BIN)/$(BINHEX)
309         CC      := $(WIND_BIN)/$(CC)
310         CF      := $(WIND_BIN)/$(CF)
311         LD      := $(CC)
312         NM      := $(WIND_BIN)/$(NM)
313         RANLIB  := $(WIND_BIN)/$(RANLIB)
314         BINXSYM_NAME := $(WIND_BIN)/$(BINXSYM)
315
316 endif   # $(TARGETOS) == vxWorks
317
318 ifeq ($(TARGETENV), nucleusarm)
319
320         # The environment for nucleus builds
321         ifeq ($(BSP_BASE_DIR),)
322                 BSP_BASE_DIR := $(SRCBASE)/../bsp
323         endif
324    
325         ifeq ($(NUCLEUS_INC_DIR),)
326                 NUCLEUS_INC_DIR := $(BSP_BASE_DIR)/rtos/nucleus/inc
327         endif
328
329         EXEEXT  := 
330         OBJEXT  := .o
331         GCINCS  := -I$(SRCBASE)/include -I$(NUCLEUS_INC_DIR)
332         GCDEFS  := -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) -DTARGETARCH_$(TARGETARCH)
333         GCOPTS  :=
334    
335         ifeq ($(OBJDIR),)
336                 OBJDIR  := $(TARGETENV)/
337         endif
338    
339         # --md:  This option compiles the source and writes make file dependency lines 
340         #        to a file. The output file is suitable for use by a make utility.
341         # -c:    Compiles but does not perform the link phase.
342         # -O2:   High optimization.
343         # ---memaccess -UL41: This option tells the compiler that the memory in the 
344         #        target system has slightly restricted or expanded capabilities.
345         #        Disables unaligned mode for code that uses pre-ARMv6 unaligned 
346         #        access behavior.
347         # "/adsabi" is added to "--apcs /interwork/$(SWST)" so that objects created
348         #       under ADS 1.2 can be linked with objects compiled under RVCT 2.2.
349         # --diag_suppress 2084,1658 = blocks the diagnostic warning "Warning: C2084W: support for --apcs /adsabi is deprecated"
350         #                 1293: Suppress "Assignment in condition" warning.
351         GCFLAGS := --md \
352                         -c \
353                         -O2 \
354                         --memaccess -UL41 \
355                         --apcs /adsabi/interwork/NOSWST \
356                         --diag_suppress 2084,1658,1293 \
357                         --li
358
359         # --cpu 'name': This option generates code for a specific ARM processor or architecture.
360         ifeq ($(TARGETCPU),2153)
361                 GCFLAGS += --cpu ARM1136J-S
362         else
363       $(error "Unknown target CPU type!")
364         endif
365
366         #CPPFLAGS       := -embeddedcplusplus
367
368         CC_TARGET       =-o $@
369         CPP_TARGET      =-o $@
370         LINK_TARGET     =-o $@
371
372         CC := tcc
373         CPP := tcpp
374         AS := armasm
375         LD := armlink
376         AR := armar -c -r --create
377
378         INSTALL := install -c
379
380         TCFLAGS :=
381
382         GLDFLAGS := 
383         GLDLIBS := --ELF --symbols --debug --map --info sizes,totals --errors link.err --list link.map --verbose
384
385         # Convert windows style directories to cygwin style.
386         # It should be used in situations where the host environment is cygwin, and
387         # the host compiler is a native Win32 app (non-cygwin). It will convert the 
388         # Windows style directories in the dependencies list to cygwin style. This is
389         # necessary for the dependency files to be included by cygwin make.
390         ifeq ($(HOSTOS),Windows_NT)
391                 FILTER_DEPENDS_IN_C_TO_OBJ_RULE := 1
392         endif
393
394 endif   # $(TARGETENV) == nucleusarm
395
396 ifeq    ($(TARGETENV), bcmmips)
397
398         OBJEXT  = .o
399         GCINCS  = -I$(SRCBASE)/include
400         GCDEFS  = -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) \
401                 -DTARGETARCH_$(TARGETARCH) -D__mips__
402         GCOPTS  = -g -O2
403         GCFLAGS = -Wall 
404         GLDFLAGS = -Wl,-tidt.dld
405
406         AS              = bcmas
407         CC              = bcmgcc
408         LD              = $(CC)
409         NM              = bcmnm
410         RANLIB          = bcmranlib
411
412 endif   # $(TARGETENV) == bcmmips
413
414 ifeq    ($(TARGETENV), klsi)
415
416         OBJEXT  = .obj
417         GCINCS  = -I$(SRCBASE)/include
418         GCDEFS  = -DTARGETENV_$(TARGETENV) -DTARGETOS_$(TARGETOS) \
419                 -DTARGETARCH_$(TARGETARCH) -D__klsi__
420
421         AS              = qtasm
422         GASFLAGS        = -m20
423         CC              = qtcc
424         TCFLAGS         = -w asm=$(GASFLAGS) +c -Vcdv -w cc=+reginfo
425
426 endif   # $(TARGETENV) == klsi
427
428 CFLAGS = $(LCINCS) $(GCINCS) $(GCDEFS) $(GCOPTS) $(GCFLAGS) $(TCFLAGS) $(HCFLAGS) \
429 $(LCDEFS) $(LCOPTS) $(LCFLAGS) $(CENV)
430
431 ASFLAGS = $(GASFLAGS) $(LASFLAGS) $(ASENV)
432 LDFLAGS = $(GLDFLAGS) $(LLDFLAGS) $(LDENV)
433 LDLIBS  = $(LLDLIBS) $(GLDLIBS)
434
435 # dependency files including the .d file itself.
436 # note the example in GNU documentation seems to have a bug:
437 # two backslashes where one is correct.
438 %.d: %.c
439 ifeq ($(findstring s, $(MAKEFLAGS) ),)
440         @ echo making $@
441 endif
442         @ $(SHELL) -ec '$(CC) -MM $(CFLAGS) $(CPPFLAGS) $< \
443         | sed '\''s/$*\.o[ :]*/$@ &/g'\'' >$@'
444
445 ifeq ($(TARGETENV), win32)
446
447 # win32 needs different command line args 
448
449 %.s: %.c
450         $(CC) /FAs $(CFLAGS) $(CPPFLAGS) /Fa$@ /c $<
451
452 %.i: %.c
453         $(CC) /E $(CFLAGS) $(CPPFLAGS) $< > $@
454
455 else # !win32
456
457 %.s: %.c
458         $(CC) -S $(CFLAGS) $(CPPFLAGS) -o $@ $<
459
460 %.i: %.c
461         $(CC) -o $@ -E -dD $(CFLAGS) $(CPPFLAGS) $<
462
463 endif # win32
464
465 ifeq    ($(TARGETENV), klsi)
466
467 %$(OBJEXT): %.c
468         $(CC) $(CFLAGS) $*.c
469
470 %$(OBJEXT): %.asm
471         $(AS) $(ASFLAGS) $*.asm
472
473 %.asm: %.c
474         $(CC) $(CFLAGS) -asm $*.c
475
476 %.i: %.c
477         $(CC) $(CFLAGS) -cc -peep -asm $*.c
478         mv $*.pp $*.i
479
480 else
481
482
483 # This command sequence will:
484 #  - Convert back-slashes to foward-slashes
485 #  - Convert long filenames to 8.3 format (e.g. Program Files --> PROGRA~1)
486 #  - Convert windows-style drive letters to cygwin style.
487 #
488 # It should be used in situations where the host environment is cygwin, and
489 # the host compiler is a native Win32 app (non-cygwin). It will convert the 
490 # Windows style directories in the dependencies list to cygwin style. This is
491 # necessary for the dependency files to be included by cygwin make.
492 define FILTER_DEPENDS
493         sed -e 's/\\/\//g'              \
494                 -e 's/Program Files/PROGRA~1/g' \
495                 -e 's/\([A-Za-z]\):\//\/cygdrive\/\1\//' < $(notdir $(@:.o=.d)) > $(@:.o=.d) && \
496         rm -f $(notdir $(@:.o=.d))
497 endef
498
499
500 $(OBJDIR)%$(OBJEXT): %.c
501         $(CC) -c $(CFLAGS) $(CPPFLAGS) $(CC_TARGET) $<
502 ifeq ($(FILTER_DEPENDS_IN_C_TO_OBJ_RULE),1)
503         ${FILTER_DEPENDS}
504 endif   
505
506 $(OBJDIR)%$(OBJEXT): %.cpp
507         $(CPP) -c $(CFLAGS) $(CPPFLAGS) $(CPP_TARGET) $<
508 ifeq ($(FILTER_DEPENDS_IN_C_TO_OBJ_RULE),1)
509         ${FILTER_DEPENDS}
510 endif   
511
512
513 endif # klsi
514
515 %.h: %.x
516         rpcgen -C -h $< > $@
517
518 %_xdr.c: %.x
519         @ (if [ ! -f `basename $<` ] ; then ln -s $< . ; fi; true)
520         rpcgen -C -c -i 0 `basename $<` > $@
521
522 # Makefile debugging rule
523 env:
524         printenv
525
526 # if the user mistakenly specified RELEASE_DIR in unix-style notation,
527 # convert it to Win32 notation for them.
528 #
529 # RELEASE_DIR is assumed to be in windows-style notation if it has both 
530 # backslashes ('\') and colons (':').
531 #
532
533 ifneq  ("$(subst \,,$(RELEASE_DIR))", "$(RELEASE_DIR)")
534 ifneq  ("$(subst :,,$(RELEASE_DIR))", "$(RELEASE_DIR)")
535 RELEASE_DIR := $(subst :,,$(RELEASE_DIR))
536 RELEASE_DIR := $(subst \,/,$(RELEASE_DIR))
537 RELEASE_DIR := //$(RELEASE_DIR)
538 endif
539 endif
540
541 # all release rules depend on a valid RELEASE_DIR
542 release: check_release_dir
543 check_release_dir:
544         @if [ "x$(RELEASE_DIR)" = "x" ]; then \
545                 echo "RELEASE_DIR is not set!"; \
546                 exit 1; \
547         fi;
548
549 include ${SRCBASE}/branding.inc