1# 2# Makefile.config 3# 4# Common configuration and setup file to generate the ACPICA tools and 5# utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc, 6# acpixtract, 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 HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.) 30# See include/platform/acenv.h for supported values. 31# Note: 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 : 36PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl 37HOST ?= _CYGWIN 38CC = gcc 39 40# 41# Common defines 42# 43OBJDIR = obj 44BINDIR = bin 45COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $< 46LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) 47PREFIX ?= /usr 48INSTALLDIR = $(PREFIX)/bin 49UNAME_S := $(shell uname -s) 50 51# 52# Host detection and configuration 53# 54ifeq ($(UNAME_S), Darwin) # Mac OS X 55HOST = _APPLE 56endif 57 58ifeq ($(UNAME_S), FreeBSD) 59HOST = _FreeBSD 60endif 61 62ifeq ($(HOST), _APPLE) 63INSTALL = cp 64INSTALLFLAGS ?= -f 65else 66INSTALL = install 67INSTALLFLAGS ?= -m 555 -s 68endif 69 70INSTALLPROG = \ 71 mkdir -p $(DESTDIR)$(INSTALLDIR); \ 72 $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) 73 74# 75# Rename a .exe file if necessary 76# 77RENAMEPROG = \ 78 @if [ -e "$(PROG).exe" ] ; then \ 79 mv $(PROG).exe $(PROG); \ 80 echo "Renamed $(PROG).exe to $(PROG)"; \ 81 fi; 82 83# 84# Copy the final executable to the local bin directory 85# 86COPYPROG = \ 87 @mkdir -p ../$(BINDIR); \ 88 cp -f $(PROG) ../$(BINDIR); \ 89 echo "Copied $(PROG) to $(FINAL_PROG)"; 90 91# 92# Main ACPICA source directories 93# 94ACPICA_SRC = ../../../source 95ACPICA_COMMON = $(ACPICA_SRC)/common 96ACPICA_TOOLS = $(ACPICA_SRC)/tools 97ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers 98ACPICA_CORE = $(ACPICA_SRC)/components 99ACPICA_INCLUDE = $(ACPICA_SRC)/include 100ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger 101ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler 102ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher 103ACPICA_EVENTS = $(ACPICA_CORE)/events 104ACPICA_EXECUTER = $(ACPICA_CORE)/executer 105ACPICA_HARDWARE = $(ACPICA_CORE)/hardware 106ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace 107ACPICA_PARSER = $(ACPICA_CORE)/parser 108ACPICA_RESOURCES = $(ACPICA_CORE)/resources 109ACPICA_TABLES = $(ACPICA_CORE)/tables 110ACPICA_UTILITIES = $(ACPICA_CORE)/utilities 111 112# 113# ACPICA tool and utility source directories 114# 115ACPIBIN = $(ACPICA_TOOLS)/acpibin 116ACPIDUMP = $(ACPICA_TOOLS)/acpidump 117ACPIEXAMPLES = $(ACPICA_TOOLS)/examples 118ACPIEXEC = $(ACPICA_TOOLS)/acpiexec 119ACPIHELP = $(ACPICA_TOOLS)/acpihelp 120ACPINAMES = $(ACPICA_TOOLS)/acpinames 121ACPISRC = $(ACPICA_TOOLS)/acpisrc 122ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract 123ASL_COMPILER = $(ACPICA_SRC)/compiler 124 125# 126# Common ACPICA header files 127# 128ACPICA_HEADERS = \ 129 $(wildcard $(ACPICA_INCLUDE)/*.h) \ 130 $(wildcard $(ACPICA_INCLUDE)/platform/*.h) 131 132# 133# Common compiler flags 134# The _GNU_SOURCE symbol is required for many hosts. 135# 136OPT_CFLAGS ?= $(CWARNINGFLAGS) 137 138# 139# Optionally disable optimizations. Optimization causes problems on 140# some compilers such as gcc 4.4 141# 142ifneq ($(NOOPT),TRUE) 143OPT_CFLAGS += -O2 -D_FORTIFY_SOURCE=2 144endif 145 146CFLAGS += \ 147 -D$(HOST)\ 148 -D_GNU_SOURCE\ 149 -I$(ACPICA_INCLUDE) 150 151# 152# Common compiler warning flags. The warning flags in addition 153# to -Wall are not automatically included in -Wall. 154# 155CWARNINGFLAGS = \ 156 -ansi\ 157 -Wall\ 158 -Wbad-function-cast\ 159 -Wdeclaration-after-statement\ 160 -Werror\ 161 -Wformat=2\ 162 -Wmissing-declarations\ 163 -Wmissing-prototypes\ 164 -Wstrict-aliasing=0\ 165 -Wstrict-prototypes\ 166 -Wswitch-default\ 167 -Wpointer-arith\ 168 -Wundef 169 170# 171# Common gcc 4+ warning flags 172# 173CWARNINGFLAGS += \ 174 -Waddress\ 175 -Waggregate-return\ 176 -Winit-self\ 177 -Winline\ 178 -Wmissing-declarations\ 179 -Wmissing-field-initializers\ 180 -Wnested-externs\ 181 -Wold-style-definition\ 182 -Woverride-init\ 183 -Wno-format-nonliteral\ 184 -Wredundant-decls 185# 186# Per-host flags and exclusions 187# 188ifneq ($(HOST), _FreeBSD) 189 CWARNINGFLAGS += \ 190 -Wempty-body 191 192 ifneq ($(HOST), _APPLE) 193 CWARNINGFLAGS += \ 194 -Wlogical-op\ 195 -Wmissing-parameter-type\ 196 -Wold-style-declaration\ 197 -Wtype-limits 198 endif 199endif 200 201# 202# Extra warning flags (for possible future use) 203# 204#CWARNINGFLAGS += \ 205# -Wcast-qual\ 206# -Wconversion\ 207# -Wshadow\ 208 209# 210# Bison/Flex configuration 211# 212# -y: act like yacc 213# 214# -i: generate case insensitive scanner 215# -s: suppress default rule, abort on unknown input 216# 217# Optional for Bison/yacc: 218# -v: verbose, produces a .output file 219# -d: produces the defines header file 220# 221# Berkeley yacc configuration 222# 223#YACC= byacc 224#YFLAGS += 225# 226YACC= bison 227YFLAGS += -y 228 229LEX= flex 230LFLAGS += -i -s 231 232