# Makefile - makefile for hwif/fw/acpi
#
# modification history
# --------------------
# 01n,19may11,scm  WIND00238999, move to acpica-unix-20110316...
# 01m,06may11,mze  add a target for the prebuild to untar
# 01l,21sep10,sem  Add support for new IA cpus
# 01k,14may10,rec  WIND00215431 - add SMP build
# 01j,19jan10,rec  move to acpica-unix-20091214
# 01i,02jul09,pee  adding empty rule pattern to catch unknown targets.
# 01h,20oct08,mdk  change chmod of extracted file to rx
# 01g,08oct08,rec  WIND00139887 change extracted file permissions
# 01f,24sep08,rec  fix link errors
# 01e,10sep08,rec  don't make debugger and disassembler
# 01d,22aug08,rbc  Fix for rclean if CPU != PENTIUM4
# 01c,18aug08,pee  adding precomp target.
# 01b,29may08,rec  add rules for non-pentium4 architectures
# 01a,14may08,rec  Created 
#
# DESCRIPTION
# This file contains the makefile rules for building the acpi library.  It
# first expands the INTEL tar file into a subdirectory.  It deletes one header
# file that is replaced by a Wind River file.  It then decends into the 
# various subdirectories and builds the objects.
#
# NOTE: only gnu builds are supported due to restrictions imposed by INTEL
#
#*/
release: acpi

precomp:

ACPICA = acpica-unix-20110316

ifeq ($(CPU),$(filter $(CPU),PENTIUM4 CORE2 ATOM CORE NEHALEM))
acpi: $(ACPICA)
	make -f Makefile.vxWorks TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) 
	cd $(ACPICA)/debugger; make -f \
          ../../Makefile.debugger TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/disassembler; make -f \
          ../../Makefile.disassembler TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/events; make -f \
          ../../Makefile.events TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/hardware; make -f \
          ../../Makefile.hardware TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/dispatcher; make -f \
          ../../Makefile.dispatcher TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/executer; make -f \
          ../../Makefile.executer TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/parser; make -f \
          ../../Makefile.parser TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/namespace; make -f \
          ../../Makefile.namespace TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/resources; make -f \
          ../../Makefile.resources TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/tables; make -f \
          ../../Makefile.tables TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/utilities; make -f \
          ../../Makefile.utilities TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)
	cd $(ACPICA)/tools/acpixtract; make -f \
          ../../../Makefile.tools TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA)


clean: $(ACPICA)
	make -f Makefile.vxWorks TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/debugger; make -f \
          ../../Makefile.debugger TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/disassembler; make -f \
          ../../Makefile.disassembler TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/events; make -f \
          ../../Makefile.events TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/hardware; make -f \
          ../../Makefile.hardware TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/dispatcher; make -f \
          ../../Makefile.dispatcher TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/executer; make -f \
          ../../Makefile.executer TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/parser; make -f \
          ../../Makefile.parser TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/namespace; make -f \
          ../../Makefile.namespace TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/resources; make -f \
          ../../Makefile.resources TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/tables; make -f \
          ../../Makefile.tables TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/utilities; make -f \
          ../../Makefile.utilities TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean
	cd $(ACPICA)/tools/acpixtract; make -f \
          ../../../Makefile.tools TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) clean

rclean: clean

man: $(ACPICA)
	make -f Makefile.vxWorks TOOL=$(TOOL) CPU=$(CPU) ACPICA=$(ACPICA) man
       
# this setup target is called from prebuild to inflate the ACPI source
# this avoids the problems due to multiple builds trying to access the 
# source even while the untar is in progress

setup: $(ACPICA)
	echo "ACPI untared"

# acpi sources are delivered as a tar file from INTEL.
# include/platform/acenv.h is replaced by a file in platform/
$(ACPICA):
	tar xvf $(ACPICA).tar
	chmod -R a+rx $(ACPICA)
else
acpi:

rclean:

man:

synopsis:

endif

% :
	@echo nothing to do for target $@

	
