xref: /illumos-gate/usr/src/cmd/acpi/iasl/Makefile (revision 20a2a10f)
1bc36eafdSMike Gerdts#
2bc36eafdSMike Gerdts# This file and its contents are supplied under the terms of the
3bc36eafdSMike Gerdts# Common Development and Distribution License ("CDDL"), version 1.0.
4bc36eafdSMike Gerdts# You may only use this file in accordance with the terms of version
5bc36eafdSMike Gerdts# 1.0 of the CDDL.
6bc36eafdSMike Gerdts#
7bc36eafdSMike Gerdts# A full copy of the text of the CDDL should have accompanied this
8bc36eafdSMike Gerdts# source.  A copy of the CDDL is also available via the Internet at
9bc36eafdSMike Gerdts# http://www.illumos.org/license/CDDL.
10bc36eafdSMike Gerdts#
1120d3bf62SJohn Levon# Copyright 2020 Joyent, Inc.
128b68969eSAndy Fiddaman# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
13bc36eafdSMike Gerdts#
14bc36eafdSMike Gerdts# Adapted from acpica/generate/unix/iasl/Makefile, which lacked a copyright
15bc36eafdSMike Gerdts# notice.
16bc36eafdSMike Gerdts#
17bc36eafdSMike GerdtsPROG=		iasl
18bc36eafdSMike Gerdts
19bc36eafdSMike Gerdtsinclude ../../Makefile.cmd
20bc36eafdSMike Gerdtsinclude ../../Makefile.cmd.64
21bc36eafdSMike Gerdtsinclude ../../Makefile.ctf
22bc36eafdSMike Gerdts
23bc36eafdSMike GerdtsOBJS =	aslanalyze.o aslascii.o aslbtypes.o aslcodegen.o aslcompile.o \
24bc36eafdSMike Gerdts	asldebug.o aslerror.o aslexternal.o aslfileio.o \
25bc36eafdSMike Gerdts	aslfiles.o aslfold.o aslhex.o asllength.o asllisting.o asllistsup.o \
26bc36eafdSMike Gerdts	aslload.o asllookup.o aslmain.o aslmap.o aslmapenter.o aslmapoutput.o \
27bc36eafdSMike Gerdts	aslmaputils.o aslmessages.o aslmethod.o aslnamesp.o asloffset.o \
28bc36eafdSMike Gerdts	aslopcodes.o asloperands.o aslopt.o asloptions.o aslpld.o aslpredef.o \
29bc36eafdSMike Gerdts	aslprepkg.o aslprintf.o aslprune.o aslresource.o aslrestype1.o \
30bc36eafdSMike Gerdts	aslrestype1i.o aslrestype2.o aslrestype2d.o aslrestype2e.o \
31bc36eafdSMike Gerdts	aslrestype2q.o aslrestype2s.o aslrestype2w.o aslstartup.o aslstubs.o \
32bc36eafdSMike Gerdts	asltransform.o asltree.o aslutils.o asluuid.o aslwalks.o aslxref.o \
33bc36eafdSMike Gerdts	aslxrefout.o dtcompile.o dtexpress.o dtfield.o dtio.o \
34bc36eafdSMike Gerdts	dtsubtable.o dttable.o dttable1.o dttable2.o dttemplate.o dtutils.o \
3535786f68SRobert Mustacchi	prexpress.o prmacros.o prscan.o prutils.o \
3635786f68SRobert Mustacchi	aslallocate.o aslcache.o aslhelp.o aslparseop.o cvcompiler.o \
3735786f68SRobert Mustacchi	cvparser.o cvdisasm.o
38bc36eafdSMike Gerdts# ../common
39bc36eafdSMike GerdtsOBJS +=	adfile.o acfileio.o adisasm.o adwalk.o ahids.o ahtable.o ahpredef.o \
4035786f68SRobert Mustacchi	ahuuids.o dmextern.o dmrestag.o dmtbinfo.o dmtbinfo1.o dmtbinfo2.o \
4135786f68SRobert Mustacchi	dmtbinfo3.o dmtable.o dmtbdump.o dmtbdump1.o dmtbdump2.o dmtbdump3.o \
4235786f68SRobert Mustacchi	getopt.o osl.o osunixxf.o dmswitch.o
43bc36eafdSMike Gerdts# usr/src/common/acpica/disassembler
44bc36eafdSMike GerdtsOBJS += dmbuffer.o dmcstyle.o dmdeferred.o dmnames.o dmopcode.o dmresrc.o \
45bc36eafdSMike Gerdts	dmresrcl.o dmresrcl2.o dmresrcs.o dmtables.o dmutils.o dmwalk.o
46bc36eafdSMike Gerdts# usr/src/common/acpica/dispatcher
47bc36eafdSMike GerdtsOBJS += dsargs.o dscontrol.o dsfield.o dsobject.o dsopcode.o dsutils.o \
4835786f68SRobert Mustacchi	dswload.o dswload2.o dswexec.o dswscope.o dswstate.o dspkginit.o
49bc36eafdSMike Gerdts# usr/src/common/acpica/executer
50bc36eafdSMike GerdtsOBJS += exconcat.o exconvrt.o excreate.o exdump.o exmisc.o exmutex.o exnames.o \
51bc36eafdSMike Gerdts	exoparg1.o exoparg2.o exoparg3.o exoparg6.o exprep.o exresolv.o \
52bc36eafdSMike Gerdts	exresop.o exresnte.o exstore.o exstoren.o exstorob.o exsystem.o \
53bc36eafdSMike Gerdts	exutils.o
54bc36eafdSMike Gerdts# usr/src/common/acpica/namespace
55bc36eafdSMike GerdtsOBJS += nsaccess.o nsalloc.o nsdump.o nsnames.o nsobject.o nsparse.o \
56bc36eafdSMike Gerdts	nssearch.o nsutils.o nswalk.o
57bc36eafdSMike Gerdts# usr/src/common/acpica/parser
58bc36eafdSMike GerdtsOBJS += psargs.o psloop.o psobject.o psopcode.o psopinfo.o psparse.o psscope.o pstree.o \
59bc36eafdSMike Gerdts	psutils.o pswalk.o
60bc36eafdSMike Gerdts# usr/src/common/acpica/tables
61bc36eafdSMike GerdtsOBJS +=	tbdata.o tbfadt.o tbinstal.o tbprint.o tbutils.o tbxface.o
62bc36eafdSMike Gerdts# usr/src/common/acpica/utilities
63bc36eafdSMike GerdtsOBJS += utaddress.o utalloc.o utascii.o utbuffer.o utcache.o utcopy.o \
64bc36eafdSMike Gerdts	utdebug.o utdecode.o utdelete.o uterror.o utexcep.o utglobal.o uthex.o \
65bc36eafdSMike Gerdts	utinit.o utlock.o utmath.o utmisc.o utmutex.o utnonansi.o utobject.o \
6620d3bf62SJohn Levon	utownerid.o utpredef.o utresdecode.o utresrc.o utstate.o \
6735786f68SRobert Mustacchi	utstring.o utstrsuppt.o utstrtoul64.o utuuid.o utxface.o utxferror.o
68bc36eafdSMike Gerdts
69bc36eafdSMike GerdtsSRCS = $(OBJS:.o=.c)
70bc36eafdSMike Gerdts
71bc36eafdSMike GerdtsACPI_CMN_SRC		= $(SRC)/common/acpica
72bc36eafdSMike Gerdts
73bc36eafdSMike Gerdts# Source used only by iasl
74bc36eafdSMike GerdtsASL_COMPILER		= compiler
75bc36eafdSMike GerdtsACPICA_DEBUGGER		= debugger
76bc36eafdSMike Gerdts# Source used by kernel module and iasl
77bc36eafdSMike GerdtsACPICA_DISASSEMBLER	= $(ACPI_CMN_SRC)/disassembler
78bc36eafdSMike GerdtsACPICA_DISPATCHER	= $(ACPI_CMN_SRC)/dispatcher
79bc36eafdSMike GerdtsACPICA_EXECUTER		= $(ACPI_CMN_SRC)/executer
80bc36eafdSMike GerdtsACPICA_NAMESPACE	= $(ACPI_CMN_SRC)/namespace
81bc36eafdSMike GerdtsACPICA_PARSER		= $(ACPI_CMN_SRC)/parser
82bc36eafdSMike GerdtsACPICA_TABLES		= $(ACPI_CMN_SRC)/tables
83bc36eafdSMike GerdtsACPICA_UTILITIES	= $(ACPI_CMN_SRC)/utilities
84bc36eafdSMike Gerdts# Source used by other programs and iasl
85bc36eafdSMike GerdtsACPICA_COMMON		= ../common
86bc36eafdSMike Gerdts
87bc36eafdSMike GerdtsVPATH = $(ACPICA_DEBUGGER):$(ACPICA_DISASSEMBLER):\
88bc36eafdSMike Gerdts	$(ACPICA_DISPATCHER):$(ACPICA_EXECUTER):$(ACPICA_NAMESPACE):\
89bc36eafdSMike Gerdts	$(ACPICA_PARSER):$(ACPICA_TABLES):$(ACPICA_UTILITIES):\
90bc36eafdSMike Gerdts	$(ACPICA_COMMON):$(ACPICA_OSL)
91bc36eafdSMike Gerdts
92bc36eafdSMike GerdtsINTERMEDIATES = \
93bc36eafdSMike Gerdts	aslcompiler.y \
94bc36eafdSMike Gerdts	aslcompilerlex.c \
95bc36eafdSMike Gerdts	aslcompilerparse.c \
96bc36eafdSMike Gerdts	dtparserlex.c \
97bc36eafdSMike Gerdts	dtparserparse.c \
98bc36eafdSMike Gerdts	prparserlex.c \
99bc36eafdSMike Gerdts	prparserparse.c \
100bc36eafdSMike Gerdts	aslcompiler.y.h \
101bc36eafdSMike Gerdts	dtparser.y.h \
102bc36eafdSMike Gerdts	prparser.y.h
103bc36eafdSMike Gerdts
10420d3bf62SJohn Levon# too much noise
1050fbb5055SJohn LevonSMATCH=off
1060fbb5055SJohn Levon
107bc36eafdSMike GerdtsCPPFLAGS += -I$(SRC)/uts/intel/sys/acpi -DACPI_ASL_COMPILER -I.
108*20a2a10fSRobert MustacchiCPPFLAGS += -DACPI_DATE=\"$(VERSION)\"
109bc36eafdSMike Gerdts
110bc36eafdSMike GerdtsLEX_C_FILES = aslcompilerlex.c dtparserlex.c prparserlex.c
111bc36eafdSMike GerdtsYACC_C_FILES = aslcompilerparse.c dtparserparse.c prparserparse.c
112bc36eafdSMike GerdtsYACC_H_FILES = aslcompiler.y.h dtparser.y.h prparser.y.h
113bc36eafdSMike GerdtsYACC_FILES = $(YACC_C_FILES) $(YACC_H_FILES)
114bc36eafdSMike Gerdts
115bc36eafdSMike Gerdtsaslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := PARSER = AslCompiler
116bc36eafdSMike Gerdtsaslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := LY_BASE = aslcompiler
117bc36eafdSMike Gerdts
118bc36eafdSMike Gerdtsdtparserlex.c dtparserparse.c dtparser.y.h := PARSER = DtParser
119bc36eafdSMike Gerdtsdtparserlex.c dtparserparse.c dtparser.y.h := LY_BASE = dtparser
120bc36eafdSMike Gerdts
121bc36eafdSMike Gerdtsprparserlex.c prparserparse.c prparser.y.h := PARSER = PrParser
122bc36eafdSMike Gerdtsprparserlex.c prparserparse.c prparser.y.h := LY_BASE = prparser
123bc36eafdSMike Gerdts
124bc36eafdSMike Gerdts$(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
125bc36eafdSMike Gerdts$(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
126bc36eafdSMike Gerdts$(YACC_FILES) := YTABC = $(LY_BASE)parse.c
127bc36eafdSMike Gerdts
128d2dd2796SAndy Fiddaman$(YACC_C_FILES:.c=.o) := CERRWARN += -_gcc=-Wno-char-subscripts
129d2dd2796SAndy Fiddaman
130bc36eafdSMike GerdtsOBJS += $(LEX_C_FILES:.c=.o) $(YACC_C_FILES:.c=.o)
131bc36eafdSMike Gerdts
132bc36eafdSMike GerdtsGM4FLAGS = -P
133bc36eafdSMike GerdtsLFLAGS = -i -s
134bc36eafdSMike Gerdts
135bc36eafdSMike Gerdts.KEEP_STATE:
136bc36eafdSMike Gerdts
137bc36eafdSMike Gerdtsall: $(YACC_FILES) .WAIT $(PROG)
138bc36eafdSMike Gerdts
139bc36eafdSMike Gerdtsaslcompiler.y: aslparser.y
140bc36eafdSMike Gerdts	$(GM4) $(GM4FLAGS) aslparser.y > $@
141bc36eafdSMike Gerdts
142bc36eafdSMike Gerdts$(LEX_C_FILES):
143bc36eafdSMike Gerdts	$(FLEX) $(LFLAGS) -P$(PARSER) -o $@ $(LEXFILE)
144bc36eafdSMike Gerdts
145bc36eafdSMike Gerdts%parse.h: %parse.c
146bc36eafdSMike Gerdts
147bc36eafdSMike Gerdts%parse.c %.y.h: %.y
148bc36eafdSMike Gerdts	_suffix=`echo $@ | awk -F. '{print $$NF}'` && \
149bc36eafdSMike Gerdts	_d=`mktemp -d $(PARSER).XXXXXX` && \
1508b68969eSAndy Fiddaman	(cd $$_d && $(BISON) -o y.tab.c -v -d -p$(PARSER) ../$(LY_BASE).y) && \
151bc36eafdSMike Gerdts	mv $$_d/y.tab.$$_suffix $@; \
152bc36eafdSMike Gerdts	_ret=$$?; \
153bc36eafdSMike Gerdts	rm -rf $$_d; \
154bc36eafdSMike Gerdts	exit $$_ret
155bc36eafdSMike Gerdts
156bc36eafdSMike Gerdts$(PROG): $(OBJS)
157bc36eafdSMike Gerdts	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
158bc36eafdSMike Gerdts	$(POST_PROCESS)
159bc36eafdSMike Gerdts
160bc36eafdSMike Gerdtsinstall: all $(ROOTUSRSBINPROG)
161bc36eafdSMike Gerdts
162bc36eafdSMike Gerdtsclean:
163bc36eafdSMike Gerdts	$(RM) $(OBJS) $(INTERMEDIATES) $(PROG)
164bc36eafdSMike Gerdts	$(RM) -r AslCompiler.?????? DtParser.?????? PrParser.??????
165bc36eafdSMike Gerdts
166bc36eafdSMike Gerdtsinclude ../../Makefile.targ
167