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 #
  17 PROG=           iasl
  18 
  19 include ../../Makefile.cmd
  20 include ../../Makefile.cmd.64
  21 include ../../Makefile.ctf
  22 
  23 OBJS =  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
  39 OBJS += 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
  44 OBJS += 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
  47 OBJS += 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
  50 OBJS += 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
  55 OBJS += 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
  58 OBJS += 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
  61 OBJS += tbdata.o tbfadt.o tbinstal.o tbprint.o tbutils.o tbxface.o
  62 # usr/src/common/acpica/utilities
  63 OBJS += 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 
  69 SRCS = $(OBJS:.o=.c)
  70 
  71 ACPI_CMN_SRC            = $(SRC)/common/acpica
  72 
  73 # Source used only by iasl
  74 ASL_COMPILER            = compiler
  75 ACPICA_DEBUGGER         = debugger
  76 # Source used by kernel module and iasl
  77 ACPICA_DISASSEMBLER     = $(ACPI_CMN_SRC)/disassembler
  78 ACPICA_DISPATCHER       = $(ACPI_CMN_SRC)/dispatcher
  79 ACPICA_EXECUTER         = $(ACPI_CMN_SRC)/executer
  80 ACPICA_NAMESPACE        = $(ACPI_CMN_SRC)/namespace
  81 ACPICA_PARSER           = $(ACPI_CMN_SRC)/parser
  82 ACPICA_TABLES           = $(ACPI_CMN_SRC)/tables
  83 ACPICA_UTILITIES        = $(ACPI_CMN_SRC)/utilities
  84 # Source used by other programs and iasl
  85 ACPICA_COMMON           = ../common
  86 
  87 VPATH = $(ACPICA_DEBUGGER):$(ACPICA_DISASSEMBLER):\
  88         $(ACPICA_DISPATCHER):$(ACPICA_EXECUTER):$(ACPICA_NAMESPACE):\
  89         $(ACPICA_PARSER):$(ACPICA_TABLES):$(ACPICA_UTILITIES):\
  90         $(ACPICA_COMMON):$(ACPICA_OSL)
  91 
  92 INTERMEDIATES = \
  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
 105 SMATCH=off
 106 
 107 CPPFLAGS += -I$(SRC)/uts/intel/sys/acpi -DACPI_ASL_COMPILER -I.
 108 
 109 LEX_C_FILES = aslcompilerlex.c dtparserlex.c prparserlex.c
 110 YACC_C_FILES = aslcompilerparse.c dtparserparse.c prparserparse.c
 111 YACC_H_FILES = aslcompiler.y.h dtparser.y.h prparser.y.h
 112 YACC_FILES = $(YACC_C_FILES) $(YACC_H_FILES)
 113 
 114 aslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := PARSER = AslCompiler
 115 aslcompilerlex.c aslcompilerparse.c aslcompiler.y.h := LY_BASE = aslcompiler
 116 
 117 dtparserlex.c dtparserparse.c dtparser.y.h := PARSER = DtParser
 118 dtparserlex.c dtparserparse.c dtparser.y.h := LY_BASE = dtparser
 119 
 120 prparserlex.c prparserparse.c prparser.y.h := PARSER = PrParser
 121 prparserlex.c prparserparse.c prparser.y.h := LY_BASE = prparser
 122 
 123 $(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
 124 $(LEX_C_FILES) := LEXFILE = $(LY_BASE).l
 125 $(YACC_FILES) := YTABC = $(LY_BASE)parse.c
 126 
 127 $(YACC_C_FILES:.c=.o) := CERRWARN += -_gcc=-Wno-char-subscripts
 128 
 129 OBJS += $(LEX_C_FILES:.c=.o) $(YACC_C_FILES:.c=.o)
 130 
 131 GM4FLAGS = -P
 132 LFLAGS = -i -s
 133 
 134 .KEEP_STATE:
 135 
 136 all: $(YACC_FILES) .WAIT $(PROG)
 137 
 138 aslcompiler.y: aslparser.y
 139         $(GM4) $(GM4FLAGS) aslparser.y > $@
 140 
 141 $(LEX_C_FILES):
 142         $(FLEX) $(LFLAGS) -P$(PARSER) -o $@ $(LEXFILE)
 143 
 144 %parse.h: %parse.c
 145 
 146 %parse.c %.y.h: %.y
 147         _suffix=`echo $@ | awk -F. '{print $$NF}'` && \
 148         _d=`mktemp -d $(PARSER).XXXXXX` && \
 149         (cd $$_d && $(BISON) -o y.tab.c -v -d -p$(PARSER) ../$(LY_BASE).y) && \
 150         mv $$_d/y.tab.$$_suffix $@; \
 151         _ret=$$?; \
 152         rm -rf $$_d; \
 153         exit $$_ret
 154 
 155 $(PROG): $(OBJS)
 156         $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
 157         $(POST_PROCESS)
 158 
 159 install: all $(ROOTUSRSBINPROG)
 160 
 161 clean:
 162         $(RM) $(OBJS) $(INTERMEDIATES) $(PROG)
 163         $(RM) -r AslCompiler.?????? DtParser.?????? PrParser.??????
 164 
 165 include ../../Makefile.targ