#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
#

PROG=		acpiexec
OBJS=		oslstubs.o
# common
OBJS +=		getopt.o acgetline.o
		
# components/debugger
OBJS +=		dbcmds.o dbdisply.o dbexec.o dbfileio.o dbhistry.o	\
		dbinput.o dbmethod.o dbnames.o dbstats.o dbutils.o	\
		dbxface.o dbconvert.o
# components/disassembler
OBJS +=		dmbuffer.o dmnames.o dmobject.o dmopcode.o dmresrc.o	\
		dmresrcl.o dmresrcs.o dmutils.o dmwalk.o dmdeferred.o	\
		dmresrcl2.o
# components/dispatcher
OBJS +=		dsargs.o dscontrol.o dsfield.o dsinit.o dsmethod.o	\
		dsmthdat.o dsobject.o dsopcode.o dsutils.o dswexec.o	\
		dswload.o dswload2.o dswscope.o dswstate.o
# components/events
OBJS +=		evevent.o evglock.o evgpe.o evgpeblk.o evgpeinit.o	\
		evgpeutil.o evmisc.o evregion.o evrgnini.o evsci.o	\
		evxface.o evxfevnt.o evxfgpe.o evxfregn.o evhandler.o
# components/executer
OBJS +=		exconfig.o exconvrt.o excreate.o exdebug.o exdump.o	\
		exfield.o exfldio.o exmisc.o exmutex.o exnames.o	\
		exoparg1.o exoparg2.o exoparg3.o exoparg6.o exprep.o	\
		exregion.o exresnte.o exresolv.o exresop.o exstore.o	\
		exstoren.o exstorob.o exsystem.o exutils.o
# components/hardware
OBJS +=		hwacpi.o hwgpe.o hwpci.o hwregs.o hwsleep.o hwvalid.o	\
		hwxface.o hwesleep.o hwxfsleep.o
# components/namespace
OBJS +=		nsaccess.o nsalloc.o nsdump.o nsdumpdv.o nseval.o	\
		nsinit.o nsload.o nsnames.o nsobject.o nsparse.o	\
		nspredef.o nsrepair.o nsrepair2.o nssearch.o nsutils.o	\
		nswalk.o nsxfeval.o nsxfname.o nsxfobj.o nsarguments.o	\
		nsconvert.o nsprepkg.o

# components/parser
OBJS +=		psargs.o psloop.o psopcode.o psparse.o psscope.o	\
		pstree.o psutils.o pswalk.o psxface.o psobject.o psopinfo.o
# components/resources
OBJS +=		rsaddr.o rscalc.o rscreate.o rsdump.o rsinfo.o rsio.o	\
		rsirq.o rslist.o rsmemory.o rsmisc.o rsutils.o		\
		rsxface.o rsdumpinfo.o rsserial.o
# components/tables
OBJS +=		tbfadt.o tbfind.o tbinstal.o tbutils.o tbxface.o	\
		tbxfroot.o tbprint.o tbxfload.o
# components/utilities
OBJS +=		utalloc.o utcache.o utcopy.o utdebug.o utdecode.o	\
		utdelete.o uteval.o utglobal.o utids.o utinit.o		\
		utlock.o utmath.o utmisc.o utmutex.o utobject.o		\
		utresrc.o utstate.o uttrack.o utosi.o utxferror.o	\
		utxface.o utaddress.o utbuffer.o uterror.o utexcep.o	\
		utownerid.o utpredef.o utstring.o utxfinit.o utxfmutex.o
# os_specific/service_layers
OBJS +=		osunixxf.o
# tools/acpiexec
OBJS +=		aeexec.o aehandlers.o aemain.o aetables.o

ACPICA=		$(SRC)/common/acpica

include		$(SRC)/cmd/Makefile.cmd

C99MODE=	$(C99_ENABLE)
CPPFLAGS +=	-DACPI_EXEC_APP -I$(ACPICA)/include -I$(ACPICA)/compiler

.KEEP_STATE:

all:		$(PROG)

clean:
		$(RM) $(OBJS)

install:	all $(ROOTPROG)

$(PROG):	$(OBJS)
		$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
		$(POST_PROCESS)

%.o:		$(ACPICA)/common/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/compiler/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/debugger/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/disassembler/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/dispatcher/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/events/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/executer/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/hardware/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/namespace/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/parser/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/resources/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/tables/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/components/utilities/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/os_specific/service_layers/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

%.o:		$(ACPICA)/tools/acpiexec/%.c
		$(COMPILE.c) -o $@ $<
		$(POST_PROCESS_O)

include		$(SRC)/cmd/Makefile.targ
