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