Debian Codegraph @

generate/unix/Makefile.config

raw ◀ ▶
2 Debian patches touch this file
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 # OPT_LDFLAGS can be overridden on the make command line by
27 # adding OPT_LDFLAGS="..." to the invocation.
28 #
29 # Notes:
30 # gcc should be version 4 or greater, otherwise some of the options
31 # used will not be recognized.
32 # Optional: Set ACPI_HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.)
33 # See include/platform/acenv.h for supported values.
34 # Note: ACPI_HOST is not nearly as important for applications as it
35 # is for the kernel-resident version of ACPICA, and it may
36 # not be necessary to change it.
37 #
38 .SUFFIXES :
39 PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpisrc acpixtract iasl
40 ACPI_HOST ?= _CYGWIN
41 CC ?= gcc
42
43 #
44 # Common defines
45 #
46 OBJDIR = obj
47 BINDIR = bin
48 COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
49 LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS) $(OPT_LDFLAGS)
50 PREFIX ?= /usr
51 INSTALLDIR = $(PREFIX)/bin
52 UNAME_S := $(shell uname -s)
53
54 #
55 # Host detection and configuration
56 #
57 ifeq ($(UNAME_S), Darwin) # Mac OS X
58 ACPI_HOST = _APPLE
59 endif
60
61 ifeq ($(UNAME_S), DragonFly)
62 ACPI_HOST = _DragonFly
63 endif
64
65 ifeq ($(UNAME_S), FreeBSD)
66 ACPI_HOST = _FreeBSD
67 endif
68
69 ifeq ($(UNAME_S), NetBSD)
70 ACPI_HOST = _NetBSD
71 endif
72
73 ifeq ($(UNAME_S), QNX)
74 ACPI_HOST = _QNX
75 endif
76
77 ifeq ($(UNAME_S), Haiku)
78 ACPI_HOST = _HAIKU
79 endif
80
81 ifeq ($(ACPI_HOST), _APPLE)
82 INSTALL = cp
83 INSTALLFLAGS ?= -f
84 else
85 INSTALL = install
86
87 # Do not strip debug info when in debug mode
88 ifeq ($(DEBUG),TRUE)
89 INSTALLFLAGS ?= -m 555
90 else
91 INSTALLFLAGS ?= -m 555 -s
92 endif
93
94 endif
95
96 INSTALLPROG = \
97 mkdir -p $(DESTDIR)$(INSTALLDIR); \
98 $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
99
100 #
101 # Rename a .exe file if necessary
102 #
103 RENAMEPROG = \
104 @if [ -e "$(PROG).exe" ] ; then \
105 mv $(PROG).exe $(PROG); \
106 echo "- Rename $(PROG).exe to $(PROG)"; \
107 fi;
108
109 #
110 # Copy the final executable to the local bin directory
111 #
112 COPYPROG = \
113 @mkdir -p ../$(BINDIR); \
114 cp -f $(PROG) ../$(BINDIR); \
115 echo "- Copy $(PROG) to $(FINAL_PROG)";
116
117 #
118 # Main ACPICA source directories
119 #
120 ACPICA_SRC = ../../../source
121 ACPICA_COMMON = $(ACPICA_SRC)/common
122 ACPICA_TOOLS = $(ACPICA_SRC)/tools
123 ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
124 ACPICA_CORE = $(ACPICA_SRC)/components
125 ACPICA_INCLUDE = $(ACPICA_SRC)/include
126 ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger
127 ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler
128 ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher
129 ACPICA_EVENTS = $(ACPICA_CORE)/events
130 ACPICA_EXECUTER = $(ACPICA_CORE)/executer
131 ACPICA_HARDWARE = $(ACPICA_CORE)/hardware
132 ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace
133 ACPICA_PARSER = $(ACPICA_CORE)/parser
134 ACPICA_RESOURCES = $(ACPICA_CORE)/resources
135 ACPICA_TABLES = $(ACPICA_CORE)/tables
136 ACPICA_UTILITIES = $(ACPICA_CORE)/utilities
137
138 #
139 # ACPICA tool and utility source directories
140 #
141 ACPIBIN = $(ACPICA_TOOLS)/acpibin
142 ACPIDUMP = $(ACPICA_TOOLS)/acpidump
143 ACPIEXAMPLES = $(ACPICA_TOOLS)/examples
144 ACPIEXEC = $(ACPICA_TOOLS)/acpiexec
145 ACPIHELP = $(ACPICA_TOOLS)/acpihelp
146 ACPISRC = $(ACPICA_TOOLS)/acpisrc
147 ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract
148 ASL_COMPILER = $(ACPICA_SRC)/compiler
149
150 #
151 # Common ACPICA header files
152 #
153 ACPICA_HEADERS = \
154 $(wildcard $(ACPICA_INCLUDE)/*.h) \
155 $(wildcard $(ACPICA_INCLUDE)/platform/*.h)
156
157 #
158 # Common compiler flags
159 # The _GNU_SOURCE symbol is required for many hosts.
160 #
161 OPT_CFLAGS ?= $(CWARNINGFLAGS)
162
163 #
164 # Debug flags
165 #
166 ifeq ($(DEBUG),TRUE)
167 CFLAGS +=-g
168 LDFLAGS +=-g
169 endif
•170
171 #
172 # Common compiler flags
173 # The _GNU_SOURCE symbol is required for many hosts.
174 #
175 ifeq ($(M32),TRUE)
176 CFLAGS +=-m32
177 LDFLAGS +=-m32
178 endif
179
180 #
181 # Common linker flags
182 #
183 OPT_LDFLAGS ?=
184
185 #
186 # Optionally disable optimizations. Optimization causes problems on
187 # some compilers such as gcc 4.4
188 #
189 ifneq ($(NOOPT),TRUE)
190 OPT_CFLAGS += -O2
191 else
•192 OPT_CFLAGS += -O0
193 endif
194
195 #
196 # Optionally disable fortify source. This option can cause
197 # compile errors in toolchains where it is already defined.
198 #
199 ifneq ($(NOFORTIFY),TRUE)
200 OPT_CFLAGS += -D_FORTIFY_SOURCE=2
201 endif
202
203 OPT_CFLAGS += -fPIC -pie
204
205 CFLAGS += \
206 -D$(ACPI_HOST)\
207 -D_GNU_SOURCE\
208 -I$(ACPICA_INCLUDE)
209
210 #
211 # QNX requires __EXT to enable most functions in its C library, analogous
212 # to _GNU_SOURCE.
213 #
214 ifeq ($(ACPI_HOST), _QNX)
215 CFLAGS+=-D__EXT
216 endif
217
218 #
219 # Common compiler warning flags. The warning flags in addition
220 # to -Wall are not automatically included in -Wall.
221 #
222 CWARNINGFLAGS = \
223 -std=c99\
224 -Wall\
225 -Wbad-function-cast\
226 -Wdeclaration-after-statement\
227 -Wformat=2\
228 -Wmissing-declarations\
229 -Wmissing-prototypes\
230 -Wstrict-aliasing=0\
231 -Wstrict-prototypes\
232 -Wswitch-default\
233 -Wpointer-arith\
234 -Wundef
235
236 ifneq ($(NOWERROR),TRUE)
237 CWARNINGFLAGS += -Werror
238 endif
239
240 #
241 # Common gcc 4+ warning flags
242 #
243 CWARNINGFLAGS += \
244 -Waddress\
245 -Waggregate-return\
246 -Winit-self\
247 -Winline\
248 -Wmissing-declarations\
249 -Wmissing-field-initializers\
250 -Wnested-externs\
251 -Wold-style-definition\
252 -Wno-format-nonliteral\
253 -Wredundant-decls
254 #
255 # Per-host flags and exclusions
256 #
257 ifneq ($(ACPI_HOST), _FreeBSD)
258 CWARNINGFLAGS += \
259 -Wempty-body
260
261 ifneq ($(ACPI_HOST), _APPLE)
262 CWARNINGFLAGS += \
263 -Woverride-init\
264 -Wlogical-op\
265 -Wmissing-parameter-type\
266 -Wold-style-declaration\
267 -Wtype-limits
268 endif
269 endif
270
271 #
272 # Extra warning flags (for possible future use)
273 #
274 #CWARNINGFLAGS += \
275 # -Wcast-qual\
276 # -Wconversion\
277 # -Wshadow\
278
279 #
280 # M4 macro processor is used to build the final parser file
281 #
282 # Bison/Flex configuration
283 #
284 # -y: act like yacc
285 #
286 # -i: generate case insensitive scanner
287 # -s: suppress default rule, abort on unknown input
288 #
289 # Optional for Bison/yacc:
290 # -v: verbose, produces a .output file
291 # -d: produces the defines header file
292 #
293 # Berkeley yacc configuration
294 #
295 #YACC= byacc
296 #YFLAGS +=
297 #
298 YACC= bison
299 YFLAGS += -y
300
301 MACROPROC= m4
302 MFLAGS= -P -I$(ASL_COMPILER)
303
304 LEX= flex
305 LFLAGS += -i -s
306 DLFLAGS += -i