Home | History | Annotate | Download | only in exe
      1 #
      2 # GNUmakefile for dhd/exe
      3 # (Basically a copy of wl/exe linux portion.)
      4 #
      5 # Copyright (C) 1999-2010, 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: GNUmakefile,v 1.9.24.4.2.4 2009/03/04 03:53:29 Exp $
     26 
     27 SRCBASE = ../..
     28 
     29 UNAME = $(shell uname)
     30 
     31 #-----------------------------------------------------------
     32 # Windows build
     33 # 1) windows, don't include Makerules due to all: conflict
     34 ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
     35 
     36 SRCFILE = 
     37 include ../../GNUmakefile.inc
     38 
     39 else # UNAME
     40 
     41 # 2) not windows, need to include first to pick up TARGETENV dependent vars
     42 include $(SRCBASE)/Makerules
     43 
     44 
     45 # Always include pktgen commands in the application
     46 CFLAGS += -DSDTEST
     47 CFLAGS += -DBCMSPI
     48 
     49 #-----------------------------------------------------------
     50 # Linux build
     51 #
     52 ifneq ($(findstring $(TARGETENV), "linux linuxmips linuxmips_be linuxarm linuxarm_le linuxarm_omap android"),)
     53 
     54 # $(TARGETARCH) is set based on TARGETENV in src/Makerules.* files
     55 DHD_OBJS := dhdu.o dhdu_linux.o bcmutils.o miniopt.o
     56 DHD_EXE  := dhd
     57 
     58 ifneq ($(findstring x86,$(TARGETARCH)),x86)
     59   DHD_EXE  := $(DHD_EXE)$(TARGETARCH)
     60   DHD_OBJS := $(DHD_OBJS:%.o=$(TARGETARCH)/%.o)
     61 endif
     62 
     63 # extra warnings
     64 CFLAGS += -Wextra $(CUSTOM_FLAGS)
     65 
     66 ifeq ($(TARGETENV), linuxarm_omap)
     67 CFLAGS += -DBGBRD
     68 endif
     69 
     70 vpath %.c $(SRCBASE)/shared
     71 
     72 all: $(DHD_EXE)
     73 
     74 $(DHD_EXE): $(DHD_OBJS)
     75 	$(CC) $(LDFLAGS) -o $@ $^
     76 
     77 $(TARGETARCH)/%.o: %.c
     78 	@mkdir -p $(TARGETARCH)
     79 	$(CC) -c $(CFLAGS) -o $@ $^
     80 
     81 clean:
     82 	@rm -rf $(TARGETARCH)
     83 	rm -f $(DHD_EXE) *.o
     84 	rm -rf build
     85 
     86 endif # linux
     87 
     88 #-----------------------------------------------------------
     89 # MacOS
     90 #
     91 ifeq ($(TARGETENV), macos)
     92 DHD_EXE := dhd_macos
     93 BUILD   := xcodebuild
     94 PROJECT := dhd.xcodeproj
     95 PROJTGT := dhd
     96 
     97 all: $(DHD_EXE)
     98 
     99 # Executable is located in build/Debug/dhd
    100 dhd_macos:
    101 	$(BUILD) -project $(PROJECT) -target $(PROJTGT) -configuration Debug build
    102 
    103 clean:
    104 	rm -f $(DHD_EXE) *.o
    105 	rm -rf build
    106 
    107 endif # macos
    108 
    109 
    110 .PHONY: all clean
    111 
    112 endif # UNAME
    113