M7350/wlan/host/Makefile
2024-09-09 08:52:07 +00:00

322 lines
10 KiB
Makefile

# AR6K Host driver makefile
#
# Minimal build invocation:
#
# make (all | clean | clobber)
#
# Extended Make invocation:
#
# make ATH_BUILD_TYPE=<build type> ATH_SDIO_STACK_BASE=<sdio stack install path> (all | clean | clobber)
#
# Notes:
# 1. This makefile must be invoked from the host/ directory
# 2. The <build type> must match an entry in localmake.linux.inc.
# 3. The localmake.linux.inc can be overridden using an include file outside the build tree.
# This file (name and path) can be set via the ATH_MAKE_INCLUDE_OVERRIDE variable.
# ** If ATH_MAKE_INCLUDE_OVERRIDE is used, you can define all build variables in that file
# instead of using command line arguments **. This feature is provided for developers
# that may want to customize the build using a single include file.
#
# For example :
#
# " make ATH_MAKE_INCLUDE_OVERRIDE=$HOME/mymake.inc "
#
# could be used, as long as "mymake.inc" defines all the required variables (see below)
#
# Required Variables:
#
# ATH_OS_SUB_TYPE - on linux, this must be "linux_2_4" for 2.4 kernels or left blank for 2.6 kernels.
# ATH_LINUXPATH - linux kernel source path
# ATH_CROSS_COMPILE_TYPE - optional cross compiler path , leave blank for local gcc compilation
# ATH_ARCH_CPU_TYPE - CPU architecture type, leave blank for local gcc compilation
# ATH_SDIO_STACK_BASE - SDIO Stack installation path to compile the SDIO HIF layer against an externally supplied
# SDIO stack source.
#
# Override variables:
#
# ATH_MAKE_INCLUDE_OVERRIDE - full path to include file which overrides the default (localmake.linux.inc)
# this file can contain other overrides specific to a developers
# workspace environment.
# ATH_BUILD_OUTPUT_OVERRIDE - output path override for compiled executable and
# database image
#
# Include local variables
ifdef ATH_MAKE_INCLUDE_OVERRIDE
_LOCALMAKE_INCLUDE = $(ATH_MAKE_INCLUDE_OVERRIDE)
else
_LOCALMAKE_INCLUDE = localmake.linux.inc
endif
-include $(_LOCALMAKE_INCLUDE)
export ATH_SRC_BASE
export ATH_BUILD_TYPE
export ATH_OS_SUB_TYPE
export ATH_LINUXPATH
export ATH_CROSS_COMPILE_TYPE
export ATH_ARCH_CPU_TYPE
export ATH_SDIO_STACK_BASE
export ATH_BUS_TYPE
export ATH_BUS_SUBTYPE
export ATH_HC_DRIVERS
export ATH_HTC_RAW_INT_ENV
export ATH_INIT_MODE_DRV_ENABLED
export ATH_ANDROID_ENV
export ATH_SOFTMAC_FILE_USED
export ATH_DEBUG_DRIVER
export ATH_AR6K_DEBUG_ALLOC
export ATH_MID_ISO_BTCOEX_USED
ATH_HOSTAPD_PATH = 3rdparty/mdm_hostapd_supp/hostapd
ATH_SUPPLICANT_PATH = 3rdparty/mdm_hostapd_supp/wpa_supplicant
ATH_SRC_BASE :=$(shell pwd)
MAKE :=make
CC :=$(ATH_CROSS_COMPILE_TYPE)gcc
LD :=$(ATH_CROSS_COMPILE_TYPE)ld
STRIP :=$(ATH_CROSS_COMPILE_TYPE)strip
ATH_HIF_TYPE :=`echo $(ATH_BUS_TYPE) | tr [:upper:] [:lower:]`
export STRIP
#export compiler variables for 3rd party applications (like the WPA supplicant)
export CC
export LD
export STRIP
# Set cross compile type (if any)
ifdef ATH_CROSS_COMPILE_TYPE
_CROSS_COMPILE_LINE := ARCH=$(ATH_ARCH_CPU_TYPE) CROSS_COMPILE=$(ATH_CROSS_COMPILE_TYPE)
endif
# Figure out module extension
ifneq ($(ATH_OS_SUB_TYPE),linux_2_4)
KMOD_EXTENSION :=ko
endif
ifeq ($(ATH_OS_SUB_TYPE),linux_2_4)
KMOD_EXTENSION :=o
endif
# Set up object output areas
ifdef ATH_BUILD_OUTPUT_OVERRIDE
_COMPILED_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE)
COMPILED_BIN_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE)
COMPILED_IMAGE_OBJECTS_PATH :=$(ATH_BUILD_OUTPUT_OVERRIDE)
_MAKE_IMAGE_OUTPUT_DIR :=
_MAKE_BIN_OUTPUT_DIR :=
_CLEAN_IMAGE_OUTPUT_DIR :=
_CLEAN_BIN_OUTPUT_DIR :=
else
_COMPILED_OBJECTS_PATH := $(ATH_SRC_BASE)/.output/$(ATH_BUILD_TYPE)-$(ATH_BUS_TYPE)
COMPILED_BIN_OBJECTS_PATH := $(ATH_SRC_BASE)/.output/bin
COMPILED_IMAGE_OBJECTS_PATH :=$(_COMPILED_OBJECTS_PATH)/$(COMPILED_OBJECTS_PREFIX)image
_MAKE_IMAGE_OUTPUT_DIR := mkdir --parents $(COMPILED_IMAGE_OBJECTS_PATH)
_MAKE_BIN_OUTPUT_DIR := mkdir --parents $(COMPILED_BIN_OBJECTS_PATH)
_CLEAN_IMAGE_OUTPUT_DIR := rm -R -f $(COMPILED_IMAGE_OBJECTS_PATH)
_CLEAN_BIN_OUTPUT_DIR := rm -R -f $(COMPILED_BIN_OBJECTS_PATH)
endif
# Export the required variables to other Makefiles in the system
export COMPILED_IMAGE_OBJECTS_PATH
export COMPILED_BIN_OBJECTS_PATH
# control variables for conditionally compiling some tools
ATH_BUILD_TOOLS ?=yes
ATH_BUILD_FTM ?=no
ATH_BUILD_3RDPARTY ?=yes
#######################
# packaging for ART
ARTROOTDIR := $(WORKAREA)/host/tools/systemtools
ARTSCRIPTDIR := $(ARTROOTDIR)/tools/scripts
# create needed directories for packaging
PKG_ROOT_DIR := $(WORKAREA)/host/tools/systemtools
PKG_PARENT_DIR := $(COMPILED_IMAGE_OBJECTS_PATH)/art_rel
PKG_DIR := $(PKG_PARENT_DIR)/art/bin
#######################
all: modules tools 3rdparty install
modules:
ifndef ATH_BUILD_TYPE
@echo "Please edit the $(_LOCALMAKE_INCLUDE) file"
exit 1
endif
$(_MAKE_IMAGE_OUTPUT_DIR)
$(_MAKE_BIN_OUTPUT_DIR)
$(MAKE) -C hif/$(ATH_HIF_TYPE)
-rm -f $(ATH_SRC_BASE)/os/linux/Module.symvers
$(MAKE) $(_CROSS_COMPILE_LINE) -C $(ATH_LINUXPATH) ATH_HIF_TYPE=$(ATH_HIF_TYPE) SUBDIRS=$(ATH_SRC_BASE)/os/linux modules
tools: FORCE
ifeq ($(ATH_BUILD_TOOLS),yes)
if [ -e tools/bmiloader/ ]; \
then \
$(MAKE) -C tools/bmiloader/; \
fi
if [ -e tools/eeprom/ ]; \
then \
$(MAKE) -C tools/eeprom/; \
fi
if [ -e tools/regDbGen/ ]; \
then \
$(MAKE) -C tools/regDbGen/; \
fi
if [ -e tools/tcmd/ ]; \
then \
$(MAKE) -C tools/tcmd/; \
fi
$(MAKE) -C tools/wmiconfig/
if [ -e tools/createimage/ ]; \
then \
$(MAKE) -C tools/createimage/; \
fi
if [ -e tools/recEvent/ ]; \
then \
$(MAKE) -C tools/recEvent/; \
fi
if [ -e tools/licensing/ ]; \
then \
$(MAKE) -C tools/licensing/; \
fi
if [ -e tools/dbgParser/ ]; \
then \
$(MAKE) -C tools/dbgParser/; \
fi
if [ -e tools/artagent ]; \
then \
$(MAKE) -C tools/artagent; \
fi
ifeq ($(ATH_BUILD_FTM),yes)
if [ -e tools/ftmdaemon ]; \
then \
$(MAKE) -C tools/ftmdaemon ; \
fi
endif
endif
3rdparty: FORCE
ifeq ($(ATH_BUILD_3RDPARTY),yes)
$(MAKE) -C $(ATH_SUPPLICANT_PATH)/../src/crypto/
$(MAKE) -C $(ATH_SUPPLICANT_PATH)/
$(MAKE) -C $(ATH_HOSTAPD_PATH)
endif
install: modules tools 3rdparty
cp -f $(ATH_SRC_BASE)/os/linux/ar6000.$(KMOD_EXTENSION) $(COMPILED_IMAGE_OBJECTS_PATH)
if test -e $(ATH_SRC_BASE)/os/linux/bt_hci_sdio.$(KMOD_EXTENSION); \
then \
cp -f $(ATH_SRC_BASE)/os/linux/bt_hci_sdio.$(KMOD_EXTENSION) $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
ifeq ($(ATH_BUILD_TOOLS),yes)
if test -e tools/bmiloader; \
then \
cp -f tools/bmiloader/bmiloader $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
if test -e tools/eeprom; \
then \
cp -f tools/eeprom/eeprom $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
cp -f tools/wmiconfig/wmiconfig $(COMPILED_IMAGE_OBJECTS_PATH)
if test -e tools/tcmd/; \
then \
cp -f tools/tcmd/athtestcmd $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
if test -e tools/recEvent/; \
then \
cp -f tools/recEvent/recEvent $(COMPILED_IMAGE_OBJECTS_PATH); \
cp -f tools/recEvent/restore.sh $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
if test -e tools/regDbGen/; \
then \
cp -f tools/regDbGen/regulatory*.bin $(COMPILED_BIN_OBJECTS_PATH); \
fi
if test -e tools/dbgParser/; \
then \
cp -f tools/dbgParser/dbgParser $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
if [ -e tools/artagent ]; \
then \
cp -f tools/artagent/artagent $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
ifeq ($(ATH_BUILD_FTM),yes)
if [ -e tools/ftmdaemon ]; \
then \
cp -f tools/ftmdaemon/ftmdaemon $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
endif
endif
ifeq ($(ATH_BUILD_3RDPARTY),yes)
$(STRIP) $(ATH_SUPPLICANT_PATH)/wpa_supplicant
$(STRIP) $(ATH_SUPPLICANT_PATH)/wpa_cli
cp -f $(ATH_SUPPLICANT_PATH)/wpa_supplicant $(COMPILED_IMAGE_OBJECTS_PATH)
cp -f $(ATH_SUPPLICANT_PATH)/wpa_cli $(COMPILED_IMAGE_OBJECTS_PATH)
cp -f $(ATH_SUPPLICANT_PATH)/wpa_eap_sim.conf $(COMPILED_IMAGE_OBJECTS_PATH)/wpa_eap_sim.conf
$(STRIP) $(ATH_HOSTAPD_PATH)/hostapd
$(STRIP) $(ATH_HOSTAPD_PATH)/hostapd_cli
$(STRIP) $(ATH_HOSTAPD_PATH)/hostapd_wps
cp -f $(ATH_HOSTAPD_PATH)/hostapd $(COMPILED_IMAGE_OBJECTS_PATH)
cp -f $(ATH_HOSTAPD_PATH)/hostapd_cli $(COMPILED_IMAGE_OBJECTS_PATH)
cp -f $(ATH_HOSTAPD_PATH)/hostapd_wps $(COMPILED_IMAGE_OBJECTS_PATH)
cp -f $(ATH_HOSTAPD_PATH)/config/ar6k* $(COMPILED_IMAGE_OBJECTS_PATH)
if [ -e 3rdparty/wapid/ ]; \
then \
cp -f 3rdparty/wapid/bin/wapid $(COMPILED_IMAGE_OBJECTS_PATH); \
cp -f 3rdparty/wapid/wapi.conf $(COMPILED_IMAGE_OBJECTS_PATH); \
fi
endif
clean:
rm -f os/linux/ar6000.mod.c os/linux/*.o os/linux/*.ko wmi/*.o htc/AR6000/src/*.o htc/*.o regtable/*.o\
bmi/src/*.o wlan/src/*.o driver/* apps/wpa_supplicant/*.o tools/athprof/athprof \
tools/bmiloader/bmiloader tools/dsetsvr/dsetsvr \
tools/regDbGen/regDomainGenDb tools/regDbGen/*.bin \
tools/wmiconfig/wmiconfig tools/eeprom/eeprom tools/eeprom/eeprom \
tools/regDbGen/regulatoryData_AG.bin.h tools/regDbGen/regulatoryData_G.bin.h \
tools/dbgParser/dbgParser btfilter/*.o btfilter/*.a \
tools/tcmd/athtestcmd \
tools/artagent/artagent \
tools/licensing/*.[od]
rm -f $(ATH_SRC_BASE)/os/linux/Module.symvers
rm -f $(ATH_SRC_BASE)/os/linux/Module.markers
rm -f $(ATH_SRC_BASE)/os/linux/modules.order
rm -rf $(ATH_SRC_BASE)/os/linux/.tmp_versions
rm -rf $(ATH_SRC_BASE)/tools/systemtools/tools/eepromUtil/Linux
rm -rf $(ATH_SRC_BASE)/tools/systemtools/tools/eepromUtil/Linux_customer
rm -f $(ATH_SRC_BASE)/sdiostack/src/Module.markers
rm -f $(ATH_SRC_BASE)/sdiostack/src/lib/modules.order
rm -f $(ATH_SRC_BASE)/sdiostack/src/modules.order
rm -f $(ATH_SRC_BASE)/sdiostack/src/busdriver/modules.order
rm -f $(ATH_SRC_BASE)/sdiostack/src/hcd/pci_std/modules.order
rm -f $(ATH_SRC_BASE)/sdiostack/src/hcd/modules.order
rm -f $(ATH_SRC_BASE)/sdiostack/src/hcd/pci_ellen/modules.order
rm -f $(COMPILED_IMAGE_OBJECTS_PATH)/*.ko
# The kernel module build process leaves some intermediate files, this will clean up all these files
find $(ATH_SRC_BASE) \( -not -path "*.output*" -a -name '*.[oas]' -o -name core -o -name '.*.flags' -o -name '.ko' -o -name '.*.cmd' \) -type f -print \
| grep -v lxdialog/ | xargs rm -f
$(MAKE) -C hif/$(ATH_HIF_TYPE) clean
if [ -e tools/ini2dset/ ]; \
then \
$(MAKE) -C tools/ini2dset/ clean; \
fi
ifeq ($(ATH_BUILD_3RDPARTY),yes)
$(MAKE) -C $(ATH_SUPPLICANT_PATH)/../src/crypto/ clean
$(MAKE) -C $(ATH_HOSTAPD_PATH)/ clean
$(MAKE) -C $(ATH_SUPPLICANT_PATH)/ clean
endif
ifeq ($(ATH_BUILD_FTM),yes)
if [ -e tools/ftmdaemon ]; \
then \
$(MAKE) -C tools/ftmdaemon clean; \
fi
endif
clobber:clean
rm -rf .output
FORCE: