1 # 2 # Makefile.config 3 # 4 # Common configuration and setup file to generate the ACPICA tools and 5 # utilities: the iASL compiler, acpiexec, acpihelp, acpisrc, acpixtract, 6 # acpibin. 7 # 8 # This file is included by the individual makefiles for each tool. 9 # 10 11 # 12 # Note: This makefile is intended to be used from within the native 13 # ACPICA directory structure, from under generate/unix. It specifically 14 # places all object files in a generate/unix subdirectory, not within 15 # the various ACPICA source directories. This prevents collisions 16 # between different compilations of the same source file with different 17 # compile options, and prevents pollution of the source code. 18 # 19 20 # 21 # Configuration 22 # 23 # OPT_CFLAGS can be overridden on the make command line by 24 # adding OPT_CFLAGS="..." to the invocation. 25 # 26 # Notes: 27 # gcc should be version 4 or greater, otherwise some of the options 28 # used will not be recognized. 29 # Optional: Set ACPI_HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.) 30 # See include/platform/acenv.h for supported values. 31 # Note: ACPI_HOST is not nearly as important for applications as it 32 # is for the kernel-resident version of ACPICA, and it may 33 # not be necessary to change it. 34 # 35 .SUFFIXES : 36 PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpisrc acpixtract iasl 37 ACPI_HOST ?= _CYGWIN 38 CC ?= gcc 39 40 # 41 # Common defines 42 # 43 OBJDIR = obj 44 BINDIR = bin 45 COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $< 46 LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) $(OPT_LDFLAGS) 47 PREFIX ?= /usr 48 INSTALLDIR = $(PREFIX)/bin 49 UNAME_S := $(shell uname -s) 50 51 # 52 # Host detection and configuration 53 # 54 ifeq ($(UNAME_S), Darwin) # Mac OS X 55 ACPI_HOST = _APPLE 56 endif 57 58 ifeq ($(UNAME_S), DragonFly) 59 ACPI_HOST = _DragonFly 60 endif 61 62 ifeq ($(UNAME_S), FreeBSD) 63 ACPI_HOST = _FreeBSD 64 endif 65 66 ifeq ($(UNAME_S), NetBSD) 67 ACPI_HOST = _NetBSD 68 endif 69 70 ifeq ($(UNAME_S), QNX) 71 ACPI_HOST = _QNX 72 endif 73 74 ifeq ($(UNAME_S), Haiku) 75 ACPI_HOST = _HAIKU 76 endif 77 78 ifeq ($(ACPI_HOST), _APPLE) 79 INSTALL = cp 80 INSTALLFLAGS ?= -f 81 else 82 INSTALL = install 83 84 # Do not strip debug info when in debug mode 85 ifeq ($(DEBUG),TRUE) 86 INSTALLFLAGS ?= -m 555 87 else 88 INSTALLFLAGS ?= -m 555 -s 89 endif 90 91 endif 92 93 INSTALLPROG = \ 94 mkdir -p $(DESTDIR)$(INSTALLDIR); \ 95 $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) 96 97 # 98 # Rename a .exe file if necessary 99 # 100 RENAMEPROG = \ 101 @if [ -e "$(PROG).exe" ] ; then \ 102 mv $(PROG).exe $(PROG); \ 103 echo "- Rename $(PROG).exe to $(PROG)"; \ 104 fi; 105 106 # 107 # Copy the final executable to the local bin directory 108 # 109 COPYPROG = \ 110 @mkdir -p ../$(BINDIR); \ 111 cp -f $(PROG) ../$(BINDIR); \ 112 echo "- Copy $(PROG) to $(FINAL_PROG)"; 113 114 # 115 # Main ACPICA source directories 116 # 117 ACPICA_SRC = ../../../source 118 ACPICA_COMMON = $(ACPICA_SRC)/common 119 ACPICA_TOOLS = $(ACPICA_SRC)/tools 120 ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers 121 ACPICA_CORE = $(ACPICA_SRC)/components 122 ACPICA_INCLUDE = $(ACPICA_SRC)/include 123 ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger 124 ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler 125 ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher 126 ACPICA_EVENTS = $(ACPICA_CORE)/events 127 ACPICA_EXECUTER = $(ACPICA_CORE)/executer 128 ACPICA_HARDWARE = $(ACPICA_CORE)/hardware 129 ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace 130 ACPICA_PARSER = $(ACPICA_CORE)/parser 131 ACPICA_RESOURCES = $(ACPICA_CORE)/resources 132 ACPICA_TABLES = $(ACPICA_CORE)/tables 133 ACPICA_UTILITIES = $(ACPICA_CORE)/utilities 134 135 # 136 # ACPICA tool and utility source directories 137 # 138 ACPIBIN = $(ACPICA_TOOLS)/acpibin 139 ACPIDUMP = $(ACPICA_TOOLS)/acpidump 140 ACPIEXAMPLES = $(ACPICA_TOOLS)/examples 141 ACPIEXEC = $(ACPICA_TOOLS)/acpiexec 142 ACPIHELP = $(ACPICA_TOOLS)/acpihelp 143 ACPISRC = $(ACPICA_TOOLS)/acpisrc 144 ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract 145 ASL_COMPILER = $(ACPICA_SRC)/compiler 146 147 # 148 # Common ACPICA header files 149 # 150 ACPICA_HEADERS = \ 151 $(wildcard $(ACPICA_INCLUDE)/*.h) \ 152 $(wildcard $(ACPICA_INCLUDE)/platform/*.h) 153 154 # 155 # Common compiler flags 156 # The _GNU_SOURCE symbol is required for many hosts. 157 # 158 OPT_CFLAGS ?= $(CWARNINGFLAGS) 159 160 # 161 # Debug flags 162 # 163 ifeq ($(DEBUG),TRUE) 164 CFLAGS +=-g 165 LDFLAGS +=-g 166 endif 167 168 # 169 # Common compiler flags 170 # The _GNU_SOURCE symbol is required for many hosts. 171 # 172 ifeq ($(M32),TRUE) 173 CFLAGS +=-m32 174 LDFLAGS +=-m32 175 endif 176 177 # 178 # Optionally disable optimizations. Optimization causes problems on 179 # some compilers such as gcc 4.4 180 # 181 ifneq ($(NOOPT),TRUE) 182 OPT_CFLAGS += -O2 183 else 184 OPT_CFLAGS += -O0 185 endif 186 187 # 188 # Optionally disable fortify source. This option can cause 189 # compile errors in toolchains where it is already defined. 190 # 191 ifneq ($(NOFORTIFY),TRUE) 192 OPT_CFLAGS += -D_FORTIFY_SOURCE=2 193 endif 194 195 CFLAGS += \ 196 -D$(ACPI_HOST)\ 197 -D_GNU_SOURCE\ 198 -I$(ACPICA_INCLUDE) 199 200 # 201 # QNX requires __EXT to enable most functions in its C library, analogous 202 # to _GNU_SOURCE. 203 # 204 ifeq ($(ACPI_HOST), _QNX) 205 CFLAGS+=-D__EXT 206 endif 207 208 # 209 # Common compiler warning flags. The warning flags in addition 210 # to -Wall are not automatically included in -Wall. 211 # 212 CWARNINGFLAGS = \ 213 -std=c99\ 214 -Wall\ 215 -Wbad-function-cast\ 216 -Wdeclaration-after-statement\ 217 -Wformat=2\ 218 -Wmissing-declarations\ 219 -Wmissing-prototypes\ 220 -Wstrict-aliasing=0\ 221 -Wstrict-prototypes\ 222 -Wswitch-default\ 223 -Wpointer-arith\ 224 -Wundef 225 226 ifneq ($(NOWERROR),TRUE) 227 CWARNINGFLAGS += -Werror 228 endif 229 230 # 231 # Common gcc 4+ warning flags 232 # 233 CWARNINGFLAGS += \ 234 -Waddress\ 235 -Waggregate-return\ 236 -Winit-self\ 237 -Winline\ 238 -Wmissing-declarations\ 239 -Wmissing-field-initializers\ 240 -Wnested-externs\ 241 -Wold-style-definition\ 242 -Wno-format-nonliteral\ 243 -Wredundant-decls 244 # 245 # Per-host flags and exclusions 246 # 247 ifneq ($(ACPI_HOST), _FreeBSD) 248 CWARNINGFLAGS += \ 249 -Wempty-body 250 251 ifneq ($(ACPI_HOST), _APPLE) 252 CWARNINGFLAGS += \ 253 -Woverride-init\ 254 -Wlogical-op\ 255 -Wmissing-parameter-type\ 256 -Wold-style-declaration\ 257 -Wtype-limits 258 endif 259 endif 260 261 # 262 # Extra warning flags (for possible future use) 263 # 264 #CWARNINGFLAGS += \ 265 # -Wcast-qual\ 266 # -Wconversion\ 267 # -Wshadow\ 268 269 # 270 # M4 macro processor is used to build the final parser file 271 # 272 # Bison/Flex configuration 273 # 274 # -y: act like yacc 275 # 276 # -i: generate case insensitive scanner 277 # -s: suppress default rule, abort on unknown input 278 # 279 # Optional for Bison/yacc: 280 # -v: verbose, produces a .output file 281 # -d: produces the defines header file 282 # 283 # Berkeley yacc configuration 284 # 285 #YACC= byacc 286 #YFLAGS += 287 # 288 YACC= bison 289 YFLAGS += -y 290 291 MACROPROC= m4 292 MFLAGS= -P -I$(ASL_COMPILER) 293 294 LEX= flex 295 LFLAGS += -i -s 296 DLFLAGS += -i 297