xref: /illumos-gate/usr/src/cmd/acpi/iasl/Makefile (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
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 2020 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 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
104# too much noise
105SMATCH=off
106
107CPPFLAGS += -I$(SRC)/uts/intel/sys/acpi -DACPI_ASL_COMPILER -I.
108CPPFLAGS += -DACPI_DATE=\"$(VERSION)\"
109
110LEX_C_FILES = aslcompilerlex.c dtparserlex.c prparserlex.c
111YACC_C_FILES = aslcompilerparse.c dtparserparse.c prparserparse.c
112YACC_H_FILES = aslcompiler.y.h dtparser.y.h prparser.y.h
113YACC_FILES = $(YACC_C_FILES) $(YACC_H_FILES)
114
115aslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := PARSER = AslCompiler
116aslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := LY_BASE = aslcompiler
117
118dtparserlex.c dtparserparse.c dtparser.y.h := PARSER = DtParser
119dtparserlex.c dtparserparse.c dtparser.y.h := LY_BASE = dtparser
120
121prparserlex.c prparserparse.c prparser.y.h := PARSER = PrParser
122prparserlex.c prparserparse.c prparser.y.h := LY_BASE = prparser
123
124$(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
125$(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
126$(YACC_FILES) := YTABC = $(LY_BASE)parse.c
127
128$(YACC_C_FILES:.c=.o) := CERRWARN += -_gcc=-Wno-char-subscripts
129
130OBJS += $(LEX_C_FILES:.c=.o) $(YACC_C_FILES:.c=.o)
131
132GM4FLAGS = -P
133LFLAGS = -i -s
134
135.KEEP_STATE:
136
137all: $(YACC_FILES) .WAIT $(PROG)
138
139aslcompiler.y: aslparser.y
140	$(GM4) $(GM4FLAGS) aslparser.y > $@
141
142$(LEX_C_FILES):
143	$(FLEX) $(LFLAGS) -P$(PARSER) -o $@ $(LEXFILE)
144
145%parse.h: %parse.c
146
147%parse.c %.y.h: %.y
148	_suffix=`echo $@ | awk -F. '{print $$NF}'` && \
149	_d=`mktemp -d $(PARSER).XXXXXX` && \
150	(cd $$_d && $(BISON) -o y.tab.c -v -d -p$(PARSER) ../$(LY_BASE).y) && \
151	mv $$_d/y.tab.$$_suffix $@; \
152	_ret=$$?; \
153	rm -rf $$_d; \
154	exit $$_ret
155
156$(PROG): $(OBJS)
157	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
158	$(POST_PROCESS)
159
160install: all $(ROOTUSRSBINPROG)
161
162clean:
163	$(RM) $(OBJS) $(INTERMEDIATES) $(PROG)
164	$(RM) -r AslCompiler.?????? DtParser.?????? PrParser.??????
165
166include ../../Makefile.targ
167