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 ($(UNAME_S), NetBSD) 63HOST = _NetBSD 64endif 65 66ifeq ($(HOST), _APPLE) 67INSTALL = cp 68INSTALLFLAGS ?= -f 69else 70INSTALL = install 71INSTALLFLAGS ?= -m 555 -s 72endif 73 74INSTALLPROG = \ 75 mkdir -p $(DESTDIR)$(INSTALLDIR); \ 76 $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) 77 78# 79# Rename a .exe file if necessary 80# 81RENAMEPROG = \ 82 @if [ -e "$(PROG).exe" ] ; then \ 83 mv $(PROG).exe $(PROG); \ 84 echo "Renamed $(PROG).exe to $(PROG)"; \ 85 fi; 86 87# 88# Copy the final executable to the local bin directory 89# 90COPYPROG = \ 91 @mkdir -p ../$(BINDIR); \ 92 cp -f $(PROG) ../$(BINDIR); \ 93 echo "Copied $(PROG) to $(FINAL_PROG)"; 94 95# 96# Main ACPICA source directories 97# 98ACPICA_SRC = ../../../source 99ACPICA_COMMON = $(ACPICA_SRC)/common 100ACPICA_TOOLS = $(ACPICA_SRC)/tools 101ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers 102ACPICA_CORE = $(ACPICA_SRC)/components 103ACPICA_INCLUDE = $(ACPICA_SRC)/include 104ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger 105ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler 106ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher 107ACPICA_EVENTS = $(ACPICA_CORE)/events 108ACPICA_EXECUTER = $(ACPICA_CORE)/executer 109ACPICA_HARDWARE = $(ACPICA_CORE)/hardware 110ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace 111ACPICA_PARSER = $(ACPICA_CORE)/parser 112ACPICA_RESOURCES = $(ACPICA_CORE)/resources 113ACPICA_TABLES = $(ACPICA_CORE)/tables 114ACPICA_UTILITIES = $(ACPICA_CORE)/utilities 115 116# 117# ACPICA tool and utility source directories 118# 119ACPIBIN = $(ACPICA_TOOLS)/acpibin 120ACPIDUMP = $(ACPICA_TOOLS)/acpidump 121ACPIEXAMPLES = $(ACPICA_TOOLS)/examples 122ACPIEXEC = $(ACPICA_TOOLS)/acpiexec 123ACPIHELP = $(ACPICA_TOOLS)/acpihelp 124ACPINAMES = $(ACPICA_TOOLS)/acpinames 125ACPISRC = $(ACPICA_TOOLS)/acpisrc 126ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract 127ASL_COMPILER = $(ACPICA_SRC)/compiler 128 129# 130# Common ACPICA header files 131# 132ACPICA_HEADERS = \ 133 $(wildcard $(ACPICA_INCLUDE)/*.h) \ 134 $(wildcard $(ACPICA_INCLUDE)/platform/*.h) 135 136# 137# Common compiler flags 138# The _GNU_SOURCE symbol is required for many hosts. 139# 140OPT_CFLAGS ?= $(CWARNINGFLAGS) 141 142# 143# Optionally disable optimizations. Optimization causes problems on 144# some compilers such as gcc 4.4 145# 146ifneq ($(NOOPT),TRUE) 147OPT_CFLAGS += -O2 148endif 149 150# 151# Optionally disable fortify source. This option can cause 152# compile errors in toolchains where it is already defined. 153# 154ifneq ($(NOFORTIFY),TRUE) 155OPT_CFLAGS += -D_FORTIFY_SOURCE=2 156endif 157 158CFLAGS += \ 159 -D$(HOST)\ 160 -D_GNU_SOURCE\ 161 -I$(ACPICA_INCLUDE) 162 163# 164# Common compiler warning flags. The warning flags in addition 165# to -Wall are not automatically included in -Wall. 166# 167CWARNINGFLAGS = \ 168 -std=c99\ 169 -Wall\ 170 -Wbad-function-cast\ 171 -Wdeclaration-after-statement\ 172 -Werror\ 173 -Wformat=2\ 174 -Wmissing-declarations\ 175 -Wmissing-prototypes\ 176 -Wstrict-aliasing=0\ 177 -Wstrict-prototypes\ 178 -Wswitch-default\ 179 -Wpointer-arith\ 180 -Wundef 181 182# 183# Common gcc 4+ warning flags 184# 185CWARNINGFLAGS += \ 186 -Waddress\ 187 -Waggregate-return\ 188 -Winit-self\ 189 -Winline\ 190 -Wmissing-declarations\ 191 -Wmissing-field-initializers\ 192 -Wnested-externs\ 193 -Wold-style-definition\ 194 -Woverride-init\ 195 -Wno-format-nonliteral\ 196 -Wredundant-decls 197# 198# Per-host flags and exclusions 199# 200ifneq ($(HOST), _FreeBSD) 201 CWARNINGFLAGS += \ 202 -Wempty-body 203 204 ifneq ($(HOST), _APPLE) 205 CWARNINGFLAGS += \ 206 -Wlogical-op\ 207 -Wmissing-parameter-type\ 208 -Wold-style-declaration\ 209 -Wtype-limits 210 endif 211endif 212 213# 214# Extra warning flags (for possible future use) 215# 216#CWARNINGFLAGS += \ 217# -Wcast-qual\ 218# -Wconversion\ 219# -Wshadow\ 220 221# 222# M4 macro processor is used to build the final parser file 223# 224# Bison/Flex configuration 225# 226# -y: act like yacc 227# 228# -i: generate case insensitive scanner 229# -s: suppress default rule, abort on unknown input 230# 231# Optional for Bison/yacc: 232# -v: verbose, produces a .output file 233# -d: produces the defines header file 234# 235# Berkeley yacc configuration 236# 237#YACC= byacc 238#YFLAGS += 239# 240YACC= bison 241YFLAGS += -y 242 243MACROPROC= m4 244MFLAGS= -P -I$(ASL_COMPILER) 245 246LEX= flex 247LFLAGS += -i -s 248