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