Makefile.config revision 1.1.1.6 1 1.1 jruoho #
2 1.1 jruoho # Makefile.config
3 1.1 jruoho #
4 1.1 jruoho # Common configuration and setup file to generate the ACPICA tools and
5 1.1.1.2 jruoho # utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc,
6 1.1.1.2 jruoho # acpixtract, acpibin.
7 1.1 jruoho #
8 1.1 jruoho # This file is included by the individual makefiles for each tool.
9 1.1 jruoho #
10 1.1 jruoho
11 1.1 jruoho #
12 1.1.1.2 jruoho # Note: This makefile is intended to be used from within the native
13 1.1.1.2 jruoho # ACPICA directory structure, from under generate/unix. It specifically
14 1.1.1.2 jruoho # places all object files in a generate/unix subdirectory, not within
15 1.1.1.2 jruoho # the various ACPICA source directories. This prevents collisions
16 1.1.1.2 jruoho # between different compilations of the same source file with different
17 1.1.1.2 jruoho # compile options, and prevents pollution of the source code.
18 1.1.1.2 jruoho #
19 1.1.1.2 jruoho
20 1.1.1.2 jruoho #
21 1.1 jruoho # Configuration
22 1.1.1.3 christos #
23 1.1.1.3 christos # OPT_CFLAGS can be overridden on the make command line by
24 1.1.1.3 christos # adding OPT_CFLAGS="..." to the invocation.
25 1.1.1.3 christos #
26 1.1.1.2 jruoho # Notes:
27 1.1.1.2 jruoho # gcc should be version 4 or greater, otherwise some of the options
28 1.1.1.3 christos # used will not be recognized.
29 1.1.1.3 christos # Optional: Set HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.)
30 1.1.1.3 christos # See include/platform/acenv.h for supported values.
31 1.1.1.3 christos # Note: HOST is not nearly as important for applications as it
32 1.1.1.3 christos # is for the kernel-resident version of ACPICA, and it may
33 1.1.1.3 christos # not be necessary to change it.
34 1.1.1.3 christos #
35 1.1.1.3 christos .SUFFIXES :
36 1.1.1.3 christos PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
37 1.1.1.3 christos HOST ?= _CYGWIN
38 1.1.1.3 christos CC = gcc
39 1.1 jruoho
40 1.1 jruoho #
41 1.1 jruoho # Common defines
42 1.1 jruoho #
43 1.1.1.3 christos OBJDIR = obj
44 1.1.1.3 christos BINDIR = bin
45 1.1.1.3 christos COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
46 1.1.1.3 christos LINKPROG = $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
47 1.1.1.3 christos PREFIX ?= /usr
48 1.1.1.3 christos INSTALLDIR = $(PREFIX)/bin
49 1.1.1.4 christos UNAME_S := $(shell uname -s)
50 1.1.1.4 christos
51 1.1.1.4 christos #
52 1.1.1.4 christos # Host detection and configuration
53 1.1.1.4 christos #
54 1.1.1.4 christos ifeq ($(UNAME_S), Darwin) # Mac OS X
55 1.1.1.4 christos HOST = _APPLE
56 1.1.1.4 christos endif
57 1.1.1.4 christos
58 1.1.1.6 christos ifeq ($(UNAME_S), DragonFly)
59 1.1.1.6 christos HOST = _DragonFly
60 1.1.1.6 christos endif
61 1.1.1.6 christos
62 1.1.1.4 christos ifeq ($(UNAME_S), FreeBSD)
63 1.1.1.4 christos HOST = _FreeBSD
64 1.1.1.4 christos endif
65 1.1.1.3 christos
66 1.1.1.5 christos ifeq ($(UNAME_S), NetBSD)
67 1.1.1.5 christos HOST = _NetBSD
68 1.1.1.5 christos endif
69 1.1.1.5 christos
70 1.1.1.3 christos ifeq ($(HOST), _APPLE)
71 1.1.1.3 christos INSTALL = cp
72 1.1.1.3 christos INSTALLFLAGS ?= -f
73 1.1.1.3 christos else
74 1.1.1.3 christos INSTALL = install
75 1.1.1.3 christos INSTALLFLAGS ?= -m 555 -s
76 1.1.1.3 christos endif
77 1.1.1.3 christos
78 1.1.1.3 christos INSTALLPROG = \
79 1.1.1.3 christos mkdir -p $(DESTDIR)$(INSTALLDIR); \
80 1.1.1.3 christos $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
81 1.1.1.3 christos
82 1.1.1.3 christos #
83 1.1.1.3 christos # Rename a .exe file if necessary
84 1.1.1.3 christos #
85 1.1.1.3 christos RENAMEPROG = \
86 1.1.1.3 christos @if [ -e "$(PROG).exe" ] ; then \
87 1.1.1.3 christos mv $(PROG).exe $(PROG); \
88 1.1.1.3 christos echo "Renamed $(PROG).exe to $(PROG)"; \
89 1.1.1.3 christos fi;
90 1.1.1.3 christos
91 1.1.1.3 christos #
92 1.1.1.3 christos # Copy the final executable to the local bin directory
93 1.1.1.3 christos #
94 1.1.1.3 christos COPYPROG = \
95 1.1.1.3 christos @mkdir -p ../$(BINDIR); \
96 1.1.1.3 christos cp -f $(PROG) ../$(BINDIR); \
97 1.1.1.3 christos echo "Copied $(PROG) to $(FINAL_PROG)";
98 1.1.1.3 christos
99 1.1.1.3 christos #
100 1.1.1.3 christos # Main ACPICA source directories
101 1.1.1.3 christos #
102 1.1.1.3 christos ACPICA_SRC = ../../../source
103 1.1.1.3 christos ACPICA_COMMON = $(ACPICA_SRC)/common
104 1.1.1.3 christos ACPICA_TOOLS = $(ACPICA_SRC)/tools
105 1.1.1.3 christos ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
106 1.1.1.3 christos ACPICA_CORE = $(ACPICA_SRC)/components
107 1.1.1.3 christos ACPICA_INCLUDE = $(ACPICA_SRC)/include
108 1.1.1.3 christos ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger
109 1.1.1.3 christos ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler
110 1.1.1.3 christos ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher
111 1.1.1.3 christos ACPICA_EVENTS = $(ACPICA_CORE)/events
112 1.1.1.3 christos ACPICA_EXECUTER = $(ACPICA_CORE)/executer
113 1.1.1.3 christos ACPICA_HARDWARE = $(ACPICA_CORE)/hardware
114 1.1.1.3 christos ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace
115 1.1.1.3 christos ACPICA_PARSER = $(ACPICA_CORE)/parser
116 1.1.1.3 christos ACPICA_RESOURCES = $(ACPICA_CORE)/resources
117 1.1.1.3 christos ACPICA_TABLES = $(ACPICA_CORE)/tables
118 1.1.1.3 christos ACPICA_UTILITIES = $(ACPICA_CORE)/utilities
119 1.1.1.3 christos
120 1.1.1.3 christos #
121 1.1.1.3 christos # ACPICA tool and utility source directories
122 1.1.1.3 christos #
123 1.1.1.3 christos ACPIBIN = $(ACPICA_TOOLS)/acpibin
124 1.1.1.3 christos ACPIDUMP = $(ACPICA_TOOLS)/acpidump
125 1.1.1.3 christos ACPIEXAMPLES = $(ACPICA_TOOLS)/examples
126 1.1.1.3 christos ACPIEXEC = $(ACPICA_TOOLS)/acpiexec
127 1.1.1.3 christos ACPIHELP = $(ACPICA_TOOLS)/acpihelp
128 1.1.1.3 christos ACPINAMES = $(ACPICA_TOOLS)/acpinames
129 1.1.1.3 christos ACPISRC = $(ACPICA_TOOLS)/acpisrc
130 1.1.1.3 christos ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract
131 1.1.1.3 christos ASL_COMPILER = $(ACPICA_SRC)/compiler
132 1.1.1.3 christos
133 1.1.1.3 christos #
134 1.1.1.3 christos # Common ACPICA header files
135 1.1.1.3 christos #
136 1.1.1.3 christos ACPICA_HEADERS = \
137 1.1.1.3 christos $(wildcard $(ACPICA_INCLUDE)/*.h) \
138 1.1.1.3 christos $(wildcard $(ACPICA_INCLUDE)/platform/*.h)
139 1.1.1.3 christos
140 1.1 jruoho #
141 1.1.1.3 christos # Common compiler flags
142 1.1.1.3 christos # The _GNU_SOURCE symbol is required for many hosts.
143 1.1 jruoho #
144 1.1.1.3 christos OPT_CFLAGS ?= $(CWARNINGFLAGS)
145 1.1.1.3 christos
146 1.1.1.3 christos #
147 1.1.1.3 christos # Optionally disable optimizations. Optimization causes problems on
148 1.1.1.3 christos # some compilers such as gcc 4.4
149 1.1.1.3 christos #
150 1.1.1.3 christos ifneq ($(NOOPT),TRUE)
151 1.1.1.5 christos OPT_CFLAGS += -O2
152 1.1.1.5 christos endif
153 1.1.1.5 christos
154 1.1.1.5 christos #
155 1.1.1.5 christos # Optionally disable fortify source. This option can cause
156 1.1.1.5 christos # compile errors in toolchains where it is already defined.
157 1.1.1.5 christos #
158 1.1.1.5 christos ifneq ($(NOFORTIFY),TRUE)
159 1.1.1.5 christos OPT_CFLAGS += -D_FORTIFY_SOURCE=2
160 1.1.1.3 christos endif
161 1.1.1.3 christos
162 1.1.1.2 jruoho CFLAGS += \
163 1.1.1.3 christos -D$(HOST)\
164 1.1.1.3 christos -D_GNU_SOURCE\
165 1.1.1.3 christos -I$(ACPICA_INCLUDE)
166 1.1.1.2 jruoho
167 1.1.1.3 christos #
168 1.1.1.3 christos # Common compiler warning flags. The warning flags in addition
169 1.1.1.3 christos # to -Wall are not automatically included in -Wall.
170 1.1.1.3 christos #
171 1.1 jruoho CWARNINGFLAGS = \
172 1.1.1.5 christos -std=c99\
173 1.1.1.3 christos -Wall\
174 1.1.1.3 christos -Wbad-function-cast\
175 1.1.1.3 christos -Wdeclaration-after-statement\
176 1.1.1.3 christos -Werror\
177 1.1.1.3 christos -Wformat=2\
178 1.1.1.3 christos -Wmissing-declarations\
179 1.1.1.3 christos -Wmissing-prototypes\
180 1.1.1.3 christos -Wstrict-aliasing=0\
181 1.1.1.3 christos -Wstrict-prototypes\
182 1.1.1.3 christos -Wswitch-default\
183 1.1.1.3 christos -Wpointer-arith\
184 1.1.1.2 jruoho -Wundef
185 1.1 jruoho
186 1.1 jruoho #
187 1.1.1.3 christos # Common gcc 4+ warning flags
188 1.1 jruoho #
189 1.1.1.2 jruoho CWARNINGFLAGS += \
190 1.1.1.3 christos -Waddress\
191 1.1.1.3 christos -Waggregate-return\
192 1.1.1.4 christos -Winit-self\
193 1.1.1.4 christos -Winline\
194 1.1.1.3 christos -Wmissing-declarations\
195 1.1.1.3 christos -Wmissing-field-initializers\
196 1.1.1.3 christos -Wnested-externs\
197 1.1.1.3 christos -Wold-style-definition\
198 1.1.1.4 christos -Woverride-init\
199 1.1.1.3 christos -Wno-format-nonliteral\
200 1.1.1.3 christos -Wredundant-decls
201 1.1.1.3 christos #
202 1.1.1.3 christos # Per-host flags and exclusions
203 1.1.1.3 christos #
204 1.1.1.3 christos ifneq ($(HOST), _FreeBSD)
205 1.1.1.3 christos CWARNINGFLAGS += \
206 1.1.1.3 christos -Wempty-body
207 1.1.1.3 christos
208 1.1.1.3 christos ifneq ($(HOST), _APPLE)
209 1.1.1.3 christos CWARNINGFLAGS += \
210 1.1.1.3 christos -Wlogical-op\
211 1.1.1.3 christos -Wmissing-parameter-type\
212 1.1.1.3 christos -Wold-style-declaration\
213 1.1.1.3 christos -Wtype-limits
214 1.1.1.3 christos endif
215 1.1.1.3 christos endif
216 1.1 jruoho
217 1.1 jruoho #
218 1.1.1.3 christos # Extra warning flags (for possible future use)
219 1.1 jruoho #
220 1.1.1.2 jruoho #CWARNINGFLAGS += \
221 1.1.1.3 christos # -Wcast-qual\
222 1.1.1.3 christos # -Wconversion\
223 1.1.1.3 christos # -Wshadow\
224 1.1 jruoho
225 1.1 jruoho #
226 1.1.1.4 christos # M4 macro processor is used to build the final parser file
227 1.1.1.4 christos #
228 1.1 jruoho # Bison/Flex configuration
229 1.1 jruoho #
230 1.1.1.2 jruoho # -y: act like yacc
231 1.1.1.2 jruoho #
232 1.1.1.2 jruoho # -i: generate case insensitive scanner
233 1.1.1.2 jruoho # -s: suppress default rule, abort on unknown input
234 1.1.1.2 jruoho #
235 1.1.1.3 christos # Optional for Bison/yacc:
236 1.1.1.3 christos # -v: verbose, produces a .output file
237 1.1.1.3 christos # -d: produces the defines header file
238 1.1.1.3 christos #
239 1.1.1.2 jruoho # Berkeley yacc configuration
240 1.1.1.2 jruoho #
241 1.1.1.2 jruoho #YACC= byacc
242 1.1.1.3 christos #YFLAGS +=
243 1.1.1.2 jruoho #
244 1.1.1.2 jruoho YACC= bison
245 1.1.1.3 christos YFLAGS += -y
246 1.1 jruoho
247 1.1.1.4 christos MACROPROC= m4
248 1.1.1.4 christos MFLAGS= -P -I$(ASL_COMPILER)
249 1.1.1.4 christos
250 1.1.1.2 jruoho LEX= flex
251 1.1.1.2 jruoho LFLAGS += -i -s
252