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