1 2# Makefile.config 3# 4# Common configuration and setup file to generate the ACPICA tools and 5# utilities: the acpidump. 6# 7# This file is included by the individual makefiles for each tool. 8# 9 10# 11# Note: This makefile is intended to be used from within the native 12# ACPICA directory structure, from under generate/efi. It specifically 13# places all object files in a generate/efi subdirectory, not within 14# the various ACPICA source directories. This prevents collisions 15# between different compilations of the same source file with different 16# compile options, and prevents pollution of the source code. 17# 18 19# 20# Configuration 21# 22# TARGET Build target platform can be overridden on the make command 23# line by adding the followings to the invocation: 24# TARGET="..." 25# Possible target (ia32, x86_64, etc.) can be used to initiate 26# a possible cross build. 27# OPT_CFLAGS Optimization CFLAGS can be overridden on the make command 28# line by adding the followings to the invocation: 29# OPT_CFLAGS="..." 30# SHARED Testing build to check if symbols are not implemented. 31# GCC won't complain missing of symbols as our programs are 32# compiled with -shared. This can be overridden on the make 33# command line by adding the followings to the invocation: 34# SHARED=false 35# Link failures should only be seen for the _start and 36# DivU64x32. They are the only 2 GNU EFI functions we are 37# using in order not to introduce architecture specific code 38# into ACPICA. 39# 40# Notes: 41# gcc should be version 4 or greater, otherwise some of the options 42# used will not be recognized. 43# 44 45.SUFFIXES : 46 47# 48# Common defines 49# 50PROGS = acpidump 51HOST = $(shell uname -m | sed s,i[3456789]86,ia32,) 52TARGET = $(shell uname -m | sed s,i[3456789]86,ia32,) 53SHARED ?= true 54OBJDIR = obj 55BINDIR = bin 56 57# 58# Main ACPICA source directories 59# 60ACPICA_SRC = ../../../source 61ACPICA_COMMON = $(ACPICA_SRC)/common 62ACPICA_TOOLS = $(ACPICA_SRC)/tools 63ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers 64ACPICA_CORE = $(ACPICA_SRC)/components 65ACPICA_INCLUDE = $(ACPICA_SRC)/include 66ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger 67ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler 68ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher 69ACPICA_EVENTS = $(ACPICA_CORE)/events 70ACPICA_EXECUTER = $(ACPICA_CORE)/executer 71ACPICA_HARDWARE = $(ACPICA_CORE)/hardware 72ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace 73ACPICA_PARSER = $(ACPICA_CORE)/parser 74ACPICA_RESOURCES = $(ACPICA_CORE)/resources 75ACPICA_TABLES = $(ACPICA_CORE)/tables 76ACPICA_UTILITIES = $(ACPICA_CORE)/utilities 77 78# 79# ACPICA tool and utility source directories 80# 81ACPIDUMP = $(ACPICA_TOOLS)/acpidump 82 83# 84# Common ACPICA header files 85# 86ACPICA_HEADERS = \ 87 $(wildcard $(ACPICA_INCLUDE)/*.h) \ 88 $(wildcard $(ACPICA_INCLUDE)/platform/*.h) 89 90# 91# GCC configuration 92# 93CC = gcc 94LD = ld 95OBJCOPY = objcopy 96 97CFLAGS = \ 98 -std=c99\ 99 -U__linux__\ 100 -U_LINUX\ 101 -D_GNU_EFI\ 102 -D_GNU_SOURCE\ 103 -fno-stack-protector\ 104 -fno-strict-aliasing\ 105 -fpic\ 106 -fshort-wchar\ 107 -I$(ACPICA_INCLUDE) 108LDFLAGS = \ 109 -nostdlib\ 110 -znocombreloc\ 111 -Bsymbolic 112ifeq ($(strip $(SHARED)), true) 113LDFLAGS += \ 114 -shared 115endif 116LIBS = \ 117 $(shell $(CC) -print-libgcc-file-name) 118OBJCOPYFLAGS = \ 119 -j .text\ 120 -j .sdata\ 121 -j .data\ 122 -j .dynamic\ 123 -j .dynsym\ 124 -j .rel\ 125 -j .rela\ 126 -j .reloc\ 127 --target=efi-app-$(TARGET) 128 129# 130# Common compiler flags 131# The _GNU_SOURCE symbol is required for many hosts. 132# 133OPT_CFLAGS ?= $(CWARNINGFLAGS) 134 135# 136# Optionally disable optimizations. Optimization causes problems on 137# some compilers such as gcc 4.4 138# 139ifneq ($(NOOPT),TRUE) 140OPT_CFLAGS += -O2 141endif 142 143# 144# Optionally disable fortify source. This option can cause 145# compile errors in toolchains where it is already defined. 146# 147ifneq ($(NOFORTIFY),TRUE) 148OPT_CFLAGS += -D_FORTIFY_SOURCE=2 149endif 150 151 152# Common compiler warning flags. The warning flags in addition 153# to -Wall are not automatically included in -Wall. 154# 155CWARNINGFLAGS = \ 156 -Wall\ 157 -Wbad-function-cast\ 158 -Wdeclaration-after-statement\ 159 -Werror\ 160 -Wformat=2\ 161 -Wmissing-declarations\ 162 -Wmissing-prototypes\ 163 -Wstrict-aliasing=0\ 164 -Wswitch-default\ 165 -Wpointer-arith\ 166 -Wempty-body\ 167 -Wlogical-op\ 168 -Wmissing-parameter-type\ 169 -Wold-style-declaration\ 170 -Wtype-limits 171# 172# Extra warning flags (for possible future use) 173# 174#CWARNINGFLAGS += \ 175# -Wcast-qual\ 176# -Wconversion\ 177# -Wshadow\ 178# -Wstrict-prototypes\ 179# -Wundef\ 180 181CFLAGS += $(OPT_CFLAGS) 182 183# 184# EFI environment definitions 185# 186EFIINC = /usr/include/efi 187 188ifeq ($(TARGET),ia32) 189 190CFLAGS += -DACPI_MACHINE_WIDTH=32 191ifeq ($(HOST),x86_64) 192EFILIB = /usr/lib32 193CFLAGS += -m32 194LDFLAGS += -melf_i386 195else # HOST eq ia32 196EFILIB = /usr/lib 197endif 198 199else # TARGET eq x86_64 200 201CFLAGS += \ 202 -DEFI_FUNCTION_WRAPPER\ 203 -DACPI_MACHINE_WIDTH=64 204ifeq ($(HOST),ia32) 205EFILIB = /usr/lib64 206CFLAGS += -m64 207LDFLAGS += -melf_x86_64 208else # HOST eq x86_64 209EFILIB = /usr/lib 210endif 211 212endif 213 214CFLAGS += \ 215 -I$(EFIINC)\ 216 -I$(EFIINC)/$(TARGET)\ 217 -I$(EFIINC)/protocol 218LDFLAGS += \ 219 -T $(EFILIB)/elf_$(TARGET)_efi.lds\ 220 -L$(EFILIB)\ 221 $(EFILIB)/crt0-efi-$(TARGET).o 222LIBS += \ 223 -lefi\ 224 -lgnuefi\ 225 226# 227# Bison/Flex configuration 228# 229# -y: act like yacc 230# 231# -i: generate case insensitive scanner 232# -s: suppress default rule, abort on unknown input 233# 234# Optional for Bison/yacc: 235# -v: verbose, produces a .output file 236# -d: produces the defines header file 237# 238YACC= bison 239YFLAGS += -y 240 241LEX= flex 242LFLAGS += -i -s 243 244# 245# Command definitions 246# 247COMPILEOBJ = $(CC) -c $(CFLAGS) -o $@ $< 248LINKPROG = $(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) 249OBJCOPYPROG = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ 250COPYPROG = \ 251 @mkdir -p ../$(BINDIR); \ 252 cp -f $< ../$(BINDIR); \ 253 echo "Copied $< to $@"; 254