4 # Common configuration and setup file to generate the ACPICA tools and
5 # utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc,
8 # This file is included by the individual makefiles for each tool.
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.
23 # OPT_CFLAGS can be overridden on the make command line by
24 # adding OPT_CFLAGS="..." to the invocation.
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.
36 PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
45 COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
46 LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
48 INSTALLDIR = $(PREFIX)/bin
49 UNAME_S := $(shell uname -s)
52 # Host detection and configuration
54 ifeq ($(UNAME_S), Darwin) # Mac OS X
58 ifeq ($(UNAME_S), FreeBSD)
62 ifeq ($(HOST), _APPLE)
67 INSTALLFLAGS ?= -m 555 -s
71 mkdir -p $(DESTDIR)$(INSTALLDIR); \
72 $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
75 # Rename a .exe file if necessary
78 @if [ -e "$(PROG).exe" ] ; then \
79 mv $(PROG).exe $(PROG); \
80 echo "Renamed $(PROG).exe to $(PROG)"; \
84 # Copy the final executable to the local bin directory
87 @mkdir -p ../$(BINDIR); \
88 cp -f $(PROG) ../$(BINDIR); \
89 echo "Copied $(PROG) to $(FINAL_PROG)";
92 # Main ACPICA source directories
94 ACPICA_SRC = ../../../source
95 ACPICA_COMMON = $(ACPICA_SRC)/common
96 ACPICA_TOOLS = $(ACPICA_SRC)/tools
97 ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
98 ACPICA_CORE = $(ACPICA_SRC)/components
99 ACPICA_INCLUDE = $(ACPICA_SRC)/include
100 ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger
101 ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler
102 ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher
103 ACPICA_EVENTS = $(ACPICA_CORE)/events
104 ACPICA_EXECUTER = $(ACPICA_CORE)/executer
105 ACPICA_HARDWARE = $(ACPICA_CORE)/hardware
106 ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace
107 ACPICA_PARSER = $(ACPICA_CORE)/parser
108 ACPICA_RESOURCES = $(ACPICA_CORE)/resources
109 ACPICA_TABLES = $(ACPICA_CORE)/tables
110 ACPICA_UTILITIES = $(ACPICA_CORE)/utilities
113 # ACPICA tool and utility source directories
115 ACPIBIN = $(ACPICA_TOOLS)/acpibin
116 ACPIDUMP = $(ACPICA_TOOLS)/acpidump
117 ACPIEXAMPLES = $(ACPICA_TOOLS)/examples
118 ACPIEXEC = $(ACPICA_TOOLS)/acpiexec
119 ACPIHELP = $(ACPICA_TOOLS)/acpihelp
120 ACPINAMES = $(ACPICA_TOOLS)/acpinames
121 ACPISRC = $(ACPICA_TOOLS)/acpisrc
122 ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract
123 ASL_COMPILER = $(ACPICA_SRC)/compiler
126 # Common ACPICA header files
129 $(wildcard $(ACPICA_INCLUDE)/*.h) \
130 $(wildcard $(ACPICA_INCLUDE)/platform/*.h)
133 # Common compiler flags
134 # The _GNU_SOURCE symbol is required for many hosts.
136 OPT_CFLAGS ?= $(CWARNINGFLAGS)
139 # Optionally disable optimizations. Optimization causes problems on
140 # some compilers such as gcc 4.4
142 ifneq ($(NOOPT),TRUE)
143 OPT_CFLAGS += -O2 -D_FORTIFY_SOURCE=2
152 # Common compiler warning flags. The warning flags in addition
153 # to -Wall are not automatically included in -Wall.
159 -Wdeclaration-after-statement\
162 -Wmissing-declarations\
163 -Wmissing-prototypes\
171 # Common gcc 4+ warning flags
178 -Wmissing-declarations\
179 -Wmissing-field-initializers\
181 -Wold-style-definition\
183 -Wno-format-nonliteral\
186 # Per-host flags and exclusions
188 ifneq ($(HOST), _FreeBSD)
192 ifneq ($(HOST), _APPLE)
195 -Wmissing-parameter-type\
196 -Wold-style-declaration\
202 # Extra warning flags (for possible future use)
210 # M4 macro processor is used to build the final parser file
212 # Bison/Flex configuration
216 # -i: generate case insensitive scanner
217 # -s: suppress default rule, abort on unknown input
219 # Optional for Bison/yacc:
220 # -v: verbose, produces a .output file
221 # -d: produces the defines header file
223 # Berkeley yacc configuration
232 MFLAGS= -P -I$(ASL_COMPILER)