1# Makefile.def 2 3# Set variables: 4# 5# for install: 6# ASL - path name of iASL compiler 7# 8# Internal variables to be pre-defined: 9# TOP - relative name of aslts directory 10# AMLMOD - name of resulting AML module (DefinitionBlock->AMLFileName) 11# without .aml extension. 12 13# Two level hierarchy of compilation: 14# optimization & (32/64 mode). 15# 16# Directory | Flags 17# |--------------------------- 18# | optimization | 32/64 mode 19# --------------------------------------- 20# opt/32 | | -r 1 21# opt/64 | | -r 2 22# nopt/32 | -oa | -r 1 23# nopt/64 | -oa | -r 2 24 25ifndef ASLTS_AMLDIR 26ifeq ("$(ASLTS_MODE)", "n32") 27 ASLTS_AMLDIR=nopt/32 28 ASLTS_ASLFLAGS="-oa -r 1" 29endif 30ifeq ("$(ASLTS_MODE)", "n64") 31 ASLTS_AMLDIR=nopt/64 32 ASLTS_ASLFLAGS="-oa -r 2" 33endif 34ifeq ("$(ASLTS_MODE)", "o32") 35 ASLTS_AMLDIR=opt/32 36 ASLTS_ASLFLAGS="-r 1" 37endif 38ifeq ("$(ASLTS_MODE)", "o64") 39 ASLTS_AMLDIR=opt/64 40 ASLTS_ASLFLAGS="-r 2" 41endif 42ifeq ("$(ASLTS_MODE)", "aslminus") 43 ASLTS_AMLDIR=aslminus/ 44 ASLTS_ASLFLAGS="-oa -r 2" 45endif 46ifeq ("$(ASLTS_MODE)", "aslplus") 47 ASLTS_AMLDIR=aslplus/ 48 ASLTS_ASLFLAGS="-oa -r 2" 49endif 50ifeq ("$(ASLTS_MODE)", "aslconvert") 51 ASLTS_AMLDIR=aslconvert/ 52 ASLTS_ASLFLAGS="-oa -r 2" 53endif 54 55endif 56ASLTS_VER ?= $(ASLTS_VER) 57 58COMMON_NO_OUTPUT_ASL_FLAGS= "-of -cr -vs" 59COMMON_ASL_FLAGS= $(COMMON_NO_OUTPUT_ASL_FLAGS)" -l -sc -sa -ic -ta -ts -so -lm -ln -ls -li" 60 61COMPILER_LOG="$(TOP)/tmp/aml/$(ASLTS_VER)/compile.txt" 62COMPILER_ERROR_LOG="$(TOP)/tmp/aml/$(ASLTS_VER)/error.txt" 63 64# Create general directory 65 66GDMODE=775 67INST= install 68INST.dir= $(INST) -d -m $(GDMODE) $@ 69ASLMOD= MAIN 70 71# Empty all (specify 'all' target, if needed, before Makefile.def include) 72 73empty_all: FORCE 74 75# Rule to create directories located into aslts/tmp/aml; 76 77$(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR): 78 @$(INST.dir) 79 80# Make-install one particular Test Case for all modes 81 82install_all_modes_of_test_case: $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR) 83 @rval=0; \ 84 if [ -f "$(ASL)" ]; then \ 85 dd=`pwd`; \ 86 echo "---- Test path: $$dd" >> $(COMPILER_LOG); \ 87 echo "---- Test path: $$dd" >> $(COMPILER_ERROR_LOG); \ 88 >&2 echo "Test path: $$dd"; \ 89 echo "---- Test type: $(ASLTS_AMLDIR) (Flags $(COMMON_ASL_FLAGS) $(ASLTS_ASLFLAGS) $(ADD_ASLFLAGS))" >> $(COMPILER_LOG); \ 90 echo "---- Test type: $(ASLTS_AMLDIR) (Flags $(COMMON_ASL_FLAGS) $(ASLTS_ASLFLAGS) $(ADD_ASLFLAGS))" >> $(COMPILER_ERROR_LOG); \ 91 for j in ${AMLMOD}; do \ 92 rm -f $$j.aml; \ 93 done; \ 94 for j in ${ASLMOD} $(ASLMODADD); do \ 95 echo "---- Compile: $$j.asl" >> $(COMPILER_LOG); \ 96 >&2 printf "%-18s" " Type: $(ASLTS_AMLDIR) "; \ 97 >&2 printf "Compile"; \ 98 "$(ASL)" $(ASLTS_ASLFLAGS) "$(COMMON_ASL_FLAGS)" $(ADD_ASLFLAGS) $$j.asl >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 99 ret=$$?; \ 100 echo "" >> $(COMPILER_LOG); \ 101 >&2 printf " => Removing files"; \ 102 rm $$j.asm; \ 103 rm $$j.c; \ 104 rm $$j.h; \ 105 rm $$j.i; \ 106 rm $$j.hex; \ 107 rm $$j.lst; \ 108 rm $$j.map; \ 109 rm $$j.nsp; \ 110 rm $$j.offset.h; \ 111 rm $$j.src; \ 112 >&2 printf " => Done "; \ 113 if [ $$ret != 0 ]; then \ 114 rval=1; \ 115 >&2 echo "**** Unexpected iASL failure in $$dd/$$j.asl!"; \ 116 fi; \ 117 done; \ 118 >&2 echo ""; \ 119 if [ $$ret != 0 ]; then break; fi; \ 120 for j in ${AMLMOD}; do \ 121 ls -l $$j.aml >> $(COMPILER_LOG); \ 122 echo "---- Move: $$j.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR)" >> $(COMPILER_LOG); \ 123 mv $$j.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR); \ 124 ret=$$?; \ 125 if [ $$ret != 0 ]; then rval=2; echo "**** mv failed!" >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); break; fi; \ 126 done; \ 127 else \ 128 echo "Bad iASL 0: <$(ASL)> does not exist"; \ 129 exit 1; \ 130 fi; 131 132# Make-install one particular Test Case for all modes. 133 134install_test_case: 135 @if [ ! -f "$(ASL)" ]; then \ 136 echo "Bad iASL 1: <$(ASL)> does not exist"; exit 1; \ 137 fi; \ 138 if [ "$(ASLTS_MODE)" = "aslminus" ]; then \ 139 make install_disasm_test_case DISASM_FLAG="-dl" ASLTS_MODE=$(ASLTS_MODE) ASLTS_VER=$(ASLTS_VER); \ 140 elif [ "$(ASLTS_MODE)" = "aslplus" ]; then \ 141 make install_disasm_test_case DISASM_FLAG="-d" ASLTS_MODE=$(ASLTS_MODE) ASLTS_VER=$(ASLTS_VER); \ 142 elif [ "$(ASLTS_MODE)" = "aslconvert" ]; then \ 143 make install_converter_test_case ASLTS_MODE=$(ASLTS_MODE) ASLTS_VER=$(ASLTS_VER); \ 144 else \ 145 make install_all_modes_of_test_case ASLTS_MODE=$(ASLTS_MODE) ASLTS_VER=$(ASLTS_VER); \ 146 fi 147 148 149TEST_SEQUENCE_ASL_FLAGS="$(ASLTS_ASLFLAGS) $(COMMON_NO_OUTPUT_ASL_FLAGS)" 150 151disasm_test_compile: $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR) 152 @rval=0; \ 153 for j in ${ASLMOD} $(ASLMODADD); do \ 154 for k in ${AMLMOD}; do \ 155 >&2 printf " => Compile with externals in place"; \ 156 "$(ASL)" -p $$k-extInPlace -oE $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS) $$j.asl >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 157 ret=$$?; \ 158 if [ $$ret != 0 ]; then \ 159 rval=2; \ 160 >&2 printf " [[ Error: compiling $$k.aml with externals in place failed ]]\n"; \ 161 >&2 printf " Flags used: -p $$k-extInPlace -oE $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS)\n\n"; \ 162 fi; \ 163 done; \ 164 done; \ 165 if [ $$rval != 0 ]; then exit 1; fi 166 167disasm_test_disassemble: disasm_test_compile 168 @rval=0; \ 169 for k in ${AMLMOD}; do \ 170 >&2 printf " => Disassemble"; \ 171 "$(ASL)" -p $$k -oe -od $(COMMON_NO_OUTPUT_ASL_FLAGS) $(ADD_ASLFLAGS) $(DISASM_FLAG) $$k-extInPlace.aml >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 172 ret=$$?; \ 173 if [ $$ret != 0 ]; then \ 174 retval=2; \ 175 >&2 printf " [[ Error: disassembly of $$k-extInPlace.aml failed ]]\n"; \ 176 >&2 printf " Flags used: -oe -od $(COMMON_NO_OUTPUT_ASL_FLAGS) $(ADD_ASLFLAGS) $(DISASM_FLAG)\n\n"; \ 177 fi; \ 178 done; \ 179 if [ $$rval != 0 ]; then exit 1; fi 180 181disasm_test_recompile: disasm_test_disassemble 182 @rval=0; \ 183 for k in ${AMLMOD}; do \ 184 >&2 printf " => Recompile\n"; \ 185 "$(ASL)" $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS) $$k.dsl >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 186 ret=$$?; \ 187 if [ $$ret != 0 ]; then \ 188 rval=2; \ 189 >&2 printf " [[ Error: re-compilation of $$k-$$l.dsl failed]]\n"; \ 190 >&2 printf " Flags used: $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS)\n\n"; \ 191 fi; \ 192 rm $$k.dsl; \ 193 echo "---- Move: $$k.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR)" >> $(COMPILER_LOG); \ 194 mv $$k.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR); \ 195 ret=$$?; \ 196 if [ $$ret != 0 ]; then rval=2; echo "**** mv failed!" >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); break; fi; \ 197 done; \ 198 199install_disasm_test_case: 200 if [ "x$(ADD_ASLFLAGS)" != "x-f" ]; then \ 201 make disasm_test_recompile; \ 202 make clean; \ 203 else \ 204 >&2 echo "Skipping disassembler test for this test case"; \ 205 fi; 206 207converter_test_convert: $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR) 208 @rval=0; \ 209 for j in ${ASLMOD} $(ASLMODADD); do \ 210 >&2 printf " Convert"; \ 211 "$(ASL)" $(ADD_ASLFLAGS) -cr -ca $$j.asl >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 212 ret=$$?; \ 213 if [ $$ret != 0 ]; then \ 214 rval=2; \ 215 >&2 printf " [[ Error: conversion of $$j.asl failed ]]\n"; \ 216 >&2 printf " Flags used: -ca\n\n"; \ 217 fi; \ 218 done; \ 219 if [ $$rval != 0 ]; then exit 1; fi 220 221converter_test_recompile: converter_test_convert 222 @rval=0; \ 223 for j in ${ASLMOD} $(ASLMODADD); do \ 224 for k in ${AMLMOD}; do \ 225 >&2 printf " => Recompile"; \ 226 "$(ASL)" $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS) -p $$k $$j.dsl >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); \ 227 ret=$$?; \ 228 if [ $$ret != 0 ]; then \ 229 rval=2; \ 230 >&2 printf " [[ Error: re-compilation of $$j.dsl failed]]\n"; \ 231 >&2 printf " Flags used: $(ADD_ASLFLAGS) $(TEST_SEQUENCE_ASL_FLAGS) -p $$k\n\n"; \ 232 else \ 233 >&2 printf " => Done\n"; \ 234 fi; \ 235 echo "---- Move: $$k.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR)" >> $(COMPILER_LOG); \ 236 mv $$k.aml $(TOP)/tmp/aml/$(ASLTS_VER)/$(ASLTS_AMLDIR); \ 237 ret=$$?; \ 238 if [ $$ret != 0 ]; then rval=2; echo "**** mv failed!" >> $(COMPILER_LOG) 2>> $(COMPILER_ERROR_LOG); break; fi; \ 239 done; \ 240 done; \ 241 242install_converter_test_case: 243 if [ "x$(ADD_ASLFLAGS)" != "x-f" ]; then \ 244 make converter_test_recompile; \ 245 make clean; \ 246 else \ 247 >&2 echo "Skipping converter test for this test case"; \ 248 fi; 249 250 251 252# Compile one particular Test Case for all modes. 253# No moving results to aslts/tmp/aml directory. 254 255compile_test_case: 256 @rval=0; \ 257 258 echo "Compile_test_case" 259 260 if [ -f "$(ASL)" ]; then \ 261 for j in ${ASLMOD} $(ASLMODADD); do \ 262 "$(ASL)" $(ASLTS_ASLFLAGS) $(ADD_ASLFLAGS) $$j.asl; \ 263 ret=$$?; \ 264 if [ $$ret != 0 ]; then rval=1; echo "**** Unexpected iASL failure!"; exit 1; fi; \ 265 done; \ 266 else \ 267 echo "Bad iASL 4: <$(ASL)> does not exist"; \ 268 rval=1; \ 269 fi; \ 270 if [ $$rval != 0 ]; then exit 1; fi 271