#
#    Copyright (C) 2009-2010  Samvinesh Christopher - American Megatrends Inc.
# 
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
# 
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
# 
#    You should have received a copy of the GNU General Public License along
#    with this program; if not, write to the Free Software Foundation, Inc.,
#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

# Add your driver files directory here
# Example SUBDIRS = usbe i2c helper
ifndef TOPDIR
TOPDIR  := $(shell cd ../../../..; pwd)
endif
include $(TOPDIR)/development/rules/Rules.global

#SUBDIRS = LPC videocap helper usbe gpio pwmtach ADC
SUBDIRS = helper LPC usbe gpio peci adc miscctrl Reset 

ifeq ($(USE_AMI_PWMTACH),YES)
SUBDIRS += pwmtach
endif

ifeq ($(SIDEBAND_LAN),YES)
SUBDIRS += sideband
endif

ifeq ($(NCSI_LAN),YES)
SUBDIRS += ncsi
endif

ifeq ($(USE_KVM),YES)
SUBDIRS += videocap
endif

all:  subdirs

# Module compilation is problematic for parallel make. Becuase if some module
# depends on symbols from another module, then the first module should be 
# compiled before the second module.
# In our case I2C drivers are dependent on each other. So till we figure out
# how to resolve this, parallel make is disabled (--jobs=1)

subdirs:
	@for n in $(SUBDIRS); do  cd $$n && $(MAKE) --jobs=1 all && cd -|| exit 1; done

install: all
	@for n in $(SUBDIRS); do  cd $$n && $(MAKE) --jobs=1 install && cd - || exit 1; done

clean:
	@for n in $(SUBDIRS); do  cd $$n && $(MAKE) --jobs=1 clean && cd -; done


