# Makefile - makefile for target/src/hwif/methods
#
# Copyright (c) 2007-2013, 2016 Wind River Systems, Inc.
#
# The right to copy, distribute, modify or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
# modification history
# --------------------
# 02y,17jun16,l_z  include defs.drivers to correct document directory. (VXW6-5624)
# 02x,31dec13,xms  add miiLpiModeGet.o. (WIND00440439)
# 02w,18sep13,e_d  add vxbSdSpecInfoGet.o and vxbSdGetIntInfo.o
# 02v,25apr13,rbc  WIND00364942 - Changes to support Unified BSP.
# 02u,08apr13,y_y  add vxbI2cBusDevShow.o. (WIND00411073)
# 02t,15jan13,j_z  add vxbIntCtlrAlloc.o, vxbIntCtlrFree.o,
#                  vxbIntDynaVecErase.o, vxbDevIntCapabCheck.o
#                  methods.(WIND00333514)
# 02s,24nov12,j_z  add vxbRioCtlrInfoGet.o and vxbMsgTransApiGet.o.
# 02r,01nov12,l_z  added vxbIntDynaVecGet.o. (WIND00373602)
# 02q,14sep12,y_y  added vxbSpiControlGet.o and vxbSpiSpecialGet.o.
# 02p,31aug12,l_z  remove vxbIntCtlrInit. (WIND00198171)
# 02o,24aug12,c_t  added vxbIoApicIntrIdGet.o
# 02n,01aug12,y_y  added vxbEepromInfoGet.o, and removed vxbEepromRead.o,
#                  vxbEepromWrite.o.
# 02m,03feb12,l_z  add EEPROM, RTC, I2C method.
# 02l,20dec11,x_z  Add vxbApmQmanFuncGet.o.
# 02k,06oct11,sas  Added vxbVbIntEnable.o and vxbVbIntDisable.o
# 02j,29sep11,sas  added MILS/VDK support - vxbVbIntEnable.o
# 02i,01jun11,rec  WIND00255358 add device power management
# 02h,21mar11,pch  CQ259377: add "where it comes from" to vxbMethodDecl.h file
#		   header & update its (c) date; re-sort OBJS_COMMON; clean up
#		   formatting.
# 02g,07may10,h_k  updated copyright year for vxbMethodDecl.h.
# 02f,28apr10,sem  Add vxbIoApicIntrRedSet.o and vxbIoApicIntrRedGet.o
# 02e,05mar10,h_k  added vxbDmaBufTagGet.o.
# 02d,03nov09,h_k  added vxbXbdDevCreate.c. (WIND00189354)
# 02c,30aug09,h_k  added busCtlrMmuAttr.o.
# 02b,25feb09,j_b  merge ARM SMP support:
#                  11nov08,j_b  add ARM GIC files
#                  09jul07,jb3  Fix Failed Zippy ns2int07Jul07-00:30
#                  06jun07,jb3  Adding vxbEbGicInt methods
# 02a,03dec08,wap  Add QorIQ methods
# 01z,14nov08,scm  add vxbIoApicRedNumEntriesGet.c to makefile...
# 01y,29oct08,pmr  WIND00140224: add vxbIntCtlrCpuDisable
# 01x,14oct08,pee  WIND00134809. Disconnecting the building of global files
#		   from the lib build/clean
# 01w,11sep08,h_k  added support for external makefiles.
# 01v,21aug08,sru  add sysBspDevFilter method
# 01u,17jun08,h_k  added busCtlrDevCtlr.
# 01t,22mar08,dlk  Added mux2DevConnect.o
# 01s,02may08,h_k  added busCtlrDevCfgRead and Write.
# 01r,06mar08,tor  add {driverControl}() and re-sort methods
# 01q,22sep07,tor  remove dup vxbMethodDecl.h,
#		   integrate better with rules.library
# 01p,04sep07,h_k  fixed an apigen error.
# 01o,10aug07,h_k  changed the LIB_BASE_NAME to drv.
# 01n,01aug07,tor  dependency improvements
# 01m,10sep07,l_z  add vxFmnControlGet.c
# 01l,20jul07,h_k  added missing back slash.
# 01k,19jul07,pmr  add vxbIntCtlrCpuAvail
# 01j,16jul07,tor  vxbMethodDecl.h not element
# 01j,17jul07,dtr  Remove unused method.
# 01i,11jul07,dtr  Add new method.
# 01h,11jun07,ami  added vxbIntLevelGet.c
# 01g,09may07,pmr  add vxbIntCtlrCpuCheck
# 01f,04may07,wap  Add vxbDevRegMap
# 01e,04may07,scm  adding APIC methods...
# 01d,19apr07,slk  add vxbIntCtlrCpuReroute.c and vxbIntCtlrIntReroute.c
# 01c,29Mar07,tor  add vxbMethodDecl.h
# 01b,19Mar07,tor  add busCtlr methods
# 01a,28Feb07,tor  created
#
# DESCRIPTION
# This file contains the makefile rules for building VxBus
# driver method IDs into the VxWorks library.
#

TGT_DIR=$(WIND_BASE)/target
LIB_BASE_NAME=drv

EXTRA_INCLUDE=-I$(TGT_DIR)/h/

#
#  When adding new methods, maintain the list in sorted order.
#

OBJS_COMMON	= \
	QorIQLawAlloc.o \
	QorIQLawFind.o \
	QorIQLawFree.o \
	busCtlrBaseAddrCvt.o \
	busCtlrCfgInfo.o \
	busCtlrCfgRead.o \
	busCtlrCfgWrite.o \
	busCtlrDevCfgRead.o \
	busCtlrDevCfgWrite.o \
	busCtlrDevCtlr.o \
	busCtlrInterruptInfo.o \
	busCtlrMmuAttr.o \
	busDevShow.o \
	busMEMIOAlloc.o \
	busMemAlloc.o \
	busMemShow.o \
	driverControl.o \
	driver_unload.o \
	instParamModify.o \
	isrRerouteNotify.o \
	ixPciBoardInit.o \
	ixPciIntAck.o \
	ixPciIntGet.o \
	ixpSioChanReset.o \
	m85xxLawBarAlloc.o \
	m85xxLawBarAllocSet.o \
	m85xxLawBarSet.o \
	m85xxWindowAlloc.o \
	miiConnectionModify.o \
	miiMediaUpdate.o \
	miiModeGet.o \
	miiModeSet.o \
	miiRead.o \
	miiWrite.o \
	miiLpiModeGet.o \
	mux2DevConnect.o \
	muxDevConnect.o \
	nonVolGet.o \
	nonVolSet.o \
	paramArraySet.o \
	paramListSet.o \
        pwrStateSet.o \
	qeCpcrCommand.o \
	qeMultiUserRamAlloc.o \
	qeMultiUserRamFree.o \
	qeThreadAlloc.o \
	qeThreadFree.o \
	sharedMemSupportAPIGet.o \
	sioChanConnect.o \
	sioChanGet.o \
	sysBspDevFilter.o \
	vxFmnControlGet.o \
	vxIpiControlGet.o \
	vxbApmQmanFuncGet.o \
	vxbArmGicIntBaseGet.o \
	vxbArmGicIntDataShow.o \
	vxbArmGicIntLvlChg.o \
	vxbArmGicIntLvlDisable.o \
	vxbArmGicIntLvlEnable.o \
	vxbArmGicIntLvlVecAck.o \
	vxbArmGicIntLvlVecChk.o \
        vxbDevIntCapabCheck.o \
	vxbDevRegMap.o \
	vxbDmaBufMapCreate.o \
	vxbDmaBufMapDestroy.o \
	vxbDmaBufMapMemAlloc.o \
	vxbDmaBufMapMemFree.o \
	vxbDmaBufTagGet.o \
	vxbDmaResourceGet.o \
	vxbDmaResourceRelease.o \
	vxbDrvUnlink.o \
	vxbEbGicIntBaseGet.o \
	vxbEbGicIntDataShow.o \
	vxbEbGicIntLvlChg.o \
	vxbEbGicIntLvlDisable.o \
	vxbEbGicIntLvlEnable.o \
	vxbEbGicIntLvlVecAck.o \
	vxbEbGicIntLvlVecChk.o \
	vxbEepromInfoGet.o \
	vxbI2cBusDevShow.o \
	vxbI2cControlGet.o \
	vxbIntCtlrAck.o \
	vxbIntCtlrConnect.o \
	vxbIntCtlrCpuAvail.o \
        vxbIntCtlrCpuCheck.o \
	vxbIntCtlrCpuDisable.o \
	vxbIntCtlrCpuReroute.o \
	vxbIntCtlrDisable.o \
	vxbIntCtlrDisconnect.o \
	vxbIntCtlrEnable.o \
	vxbIntCtlrIntReroute.o \
	vxbIntCtlrLevelGet.o \
        vxbIntCtlrAlloc.o \
        vxbIntCtlrFree.o \
	vxbIntDynaVecAlloc.o \
	vxbIntDynaVecConnect.o \
	vxbIntDynaVecDisable.o \
	vxbIntDynaVecEnable.o \
        vxbIntDynaVecErase.o \
	vxbIntDynaVecGet.o \
	vxbIntDynaVecMultiConnect.o \
	vxbIntDynaVecMultiProgram.o \
	vxbIntDynaVecOwnerFind.o \
	vxbIntDynaVecProgram.o \
        vxbIoApicIntrBaseGet.o \
        vxbIoApicIntrDataShow.o \
        vxbIoApicIntrIntDisable.o \
        vxbIoApicIntrIntEnable.o \
        vxbIoApicIntrIntLock.o \
        vxbIoApicIntrIntUnlock.o \
	vxbIoApicIntrIdGet.o \
	vxbIoApicIntrRedGet.o \
	vxbIoApicIntrRedSet.o \
        vxbIoApicIntrVersionGet.o \
	vxbIoApicRedNumEntriesGet.o \
        vxbLoApicIntrBaseGet.o \
        vxbLoApicIntrEnable.o \
        vxbLoApicIntrInitAP.o \
        vxbLoApicIntrIntLock.o \
        vxbLoApicIntrIntUnlock.o \
        vxbLoApicIntrIpi.o \
        vxbLoApicIntrShow.o \
        vxbMpApicAddrTableGet.o \
        vxbMpApicBusTableGet.o \
        vxbMpApicCpuIndexTableGet.o \
        vxbMpApicDataShow.o \
        vxbMpApicFpsGet.o \
        vxbMpApicInterruptTableGet.o \
        vxbMpApicLoIndexTableGet.o \
	vxbMpApicLogicalTableGet.o \
        vxbMpApicNbusGet.o \
        vxbMpApicNioApicGet.o \
        vxbMpApicNiointGet.o \
        vxbMpApicNlointGet.o \
	vxbMpApicloBaseGet.o \
        vxbMsgTransApiGet.o \
        vxbRioCtlrInfoGet.o \
        vxbRtcFuncGet.o \
        vxbSpiControlGet.o \
        vxbSpiSpecialGet.o \
        vxbSdGetIntInfo.o \
        vxbSdSpecInfoGet.o \
	vxbPciAddrConvertPimmr.o \
	vxbTimerFuncGet.o \
	vxbVbIntDisable.o \
	vxbVbIntEnable.o \
	vxbXbdDevCreate.o

# Pick up individual driver Makefiles

include $(wildcard $(sort *.mk))

OBJS = $(OBJS_COMMON)

EXTRA_DEFINE += -DINCLUDE_VXBUS -I$(TGT_DIR)/src/hwif -I$(TGT_DIR)/src/hwif/h
CC_OPTIM=$(CC_OPTIM_NORMAL)

METHOD_DECL =	$(WIND_BASE)/target/h/hwif/vxbus/vxbMethodDecl.h
MK_VXBMETHODDECL = TRUE

include $(TGT_DIR)/h/make/rules.library
include $(TGT_DIR)/h/make/defs.drivers

METHOD_SRC    := $(wildcard ${WIND_BASE}/target/src/hwif/methods/*.c)

.PHONY: vxbMethodDecl.h

vxbMethodDecl.h: $(METHOD_DECL)

$(METHOD_DECL): $(METHOD_SRC)
	@ $(RM) $(METHOD_DECL)
	@ echo building vxbMethodDecl.h
	@ echo '/* vxbMethodDecl.h - VxBus driver method forward declarations */'       > $(METHOD_DECL)
	@ echo ''                                                                       >> $(METHOD_DECL)
	@ echo '/*'	>> $(METHOD_DECL)
	@ echo ' * Copyright (C) 2007-2011 Wind River Systems, Inc.'		  >> $(METHOD_DECL)
	@ echo ' * All rights reserved.'		       >> $(METHOD_DECL)
	@ echo ' * '									>> $(METHOD_DECL)
	@ echo ' * The right to copy, distribute, modify, or otherwise make use'		>> $(METHOD_DECL)
	@ echo ' * of this software may be licensed only pursuant to the terms'		>> $(METHOD_DECL)
	@ echo ' * of an applicable Wind River license agreement.'			>> $(METHOD_DECL)
	@ echo ' */'									>> $(METHOD_DECL)
	@ echo ''                                                                       >> $(METHOD_DECL)
	@ echo '/*'                                                                     >> $(METHOD_DECL)
	@ echo ' *  DO NOT MODIFY THIS FILE MANUALLY'                                    >> $(METHOD_DECL)
	@ echo ' *'                                                                      >> $(METHOD_DECL)
	@ echo ' *  This file is automatically generated from' >> $(METHOD_DECL)
	@ echo ' *  the contents of target/src/hwif/methods *.c.'		  >> $(METHOD_DECL)
	@ echo ' *'					       >> $(METHOD_DECL)
	@ echo ' *  To build this file, change directory'      >> $(METHOD_DECL)
	@ echo ' *  to target/src/hwif/methods and run:'       >> $(METHOD_DECL)
	@ echo ' *       make vxbMethodDecl.h'                                           >> $(METHOD_DECL)
	@ echo ' *'                                                                      >> $(METHOD_DECL)
	@ echo ' */'                                                                     >> $(METHOD_DECL)
	@ echo ''                                                                       >> $(METHOD_DECL)
	@ grep DEVMETHOD_DEF $(WIND_BASE)/target/src/hwif/methods/*.c | \
		sed -e 's/.*\.c://' -e 's/,.*)/)/' \
		-e 's/DEVMETHOD_DEF/METHOD_DECL/'	       >> $(METHOD_DECL)
