aboutsummaryrefslogtreecommitdiff
path: root/generate/unix/Makefile.config
blob: da0f61d5147c05fae6c2b3c9e227eaf876d51adc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#
# Makefile.config
#
# Common configuration and setup file to generate the ACPICA tools and
# utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc,
# acpixtract, acpibin.
#
# This file is included by the individual makefiles for each tool.
#

#
# Note: This makefile is intended to be used from within the native
# ACPICA directory structure, from under generate/unix. It specifically
# places all object files in a generate/unix subdirectory, not within
# the various ACPICA source directories. This prevents collisions
# between different compilations of the same source file with different
# compile options, and prevents pollution of the source code.
#

#
# Configuration
#
# OPT_CFLAGS can be overridden on the make command line by
#   adding OPT_CFLAGS="..." to the invocation.
#
# Notes:
#   gcc should be version 4 or greater, otherwise some of the options
#     used will not be recognized.
#   Optional: Set HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.)
#     See include/platform/acenv.h for supported values.
#     Note: HOST is not nearly as important for applications as it
#     is for the kernel-resident version of ACPICA, and it may
#     not be necessary to change it.
#
.SUFFIXES :
PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
HOST ?= _CYGWIN
CC =    gcc

#
# Common defines
#
OBJDIR =     obj
BINDIR =     bin
COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
PREFIX ?=    /usr
INSTALLDIR = $(PREFIX)/bin
UNAME_S := $(shell uname -s)

#
# Host detection and configuration
#
ifeq ($(UNAME_S), Darwin)  # Mac OS X
HOST =       _APPLE
endif

ifeq ($(UNAME_S), DragonFly)
HOST =       _DragonFly
endif

ifeq ($(UNAME_S), FreeBSD)
HOST =       _FreeBSD
endif

ifeq ($(UNAME_S), NetBSD)
HOST =       _NetBSD
endif

ifeq ($(UNAME_S), QNX)
HOST =       _QNX
endif

ifeq ($(HOST), _APPLE)
INSTALL  =   cp
INSTALLFLAGS ?= -f
else
INSTALL =    install
INSTALLFLAGS ?= -m 555 -s
endif

INSTALLPROG = \
	mkdir -p $(DESTDIR)$(INSTALLDIR); \
	$(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)

#
# Rename a .exe file if necessary
#
RENAMEPROG = \
	@if [ -e "$(PROG).exe" ] ; then \
		mv $(PROG).exe $(PROG); \
		echo "Renamed $(PROG).exe to $(PROG)"; \
	fi;

#
# Copy the final executable to the local bin directory
#
COPYPROG = \
	@mkdir -p ../$(BINDIR); \
	cp -f $(PROG) ../$(BINDIR); \
	echo "Copied $(PROG) to $(FINAL_PROG)";

#
# Main ACPICA source directories
#
ACPICA_SRC =            ../../../source
ACPICA_COMMON =         $(ACPICA_SRC)/common
ACPICA_TOOLS =          $(ACPICA_SRC)/tools
ACPICA_OSL =            $(ACPICA_SRC)/os_specific/service_layers
ACPICA_CORE =           $(ACPICA_SRC)/components
ACPICA_INCLUDE =        $(ACPICA_SRC)/include
ACPICA_DEBUGGER =       $(ACPICA_CORE)/debugger
ACPICA_DISASSEMBLER =   $(ACPICA_CORE)/disassembler
ACPICA_DISPATCHER =     $(ACPICA_CORE)/dispatcher
ACPICA_EVENTS =         $(ACPICA_CORE)/events
ACPICA_EXECUTER =       $(ACPICA_CORE)/executer
ACPICA_HARDWARE =       $(ACPICA_CORE)/hardware
ACPICA_NAMESPACE =      $(ACPICA_CORE)/namespace
ACPICA_PARSER =         $(ACPICA_CORE)/parser
ACPICA_RESOURCES =      $(ACPICA_CORE)/resources
ACPICA_TABLES =         $(ACPICA_CORE)/tables
ACPICA_UTILITIES =      $(ACPICA_CORE)/utilities

#
# ACPICA tool and utility source directories
#
ACPIBIN =               $(ACPICA_TOOLS)/acpibin
ACPIDUMP =              $(ACPICA_TOOLS)/acpidump
ACPIEXAMPLES =          $(ACPICA_TOOLS)/examples
ACPIEXEC =              $(ACPICA_TOOLS)/acpiexec
ACPIHELP =              $(ACPICA_TOOLS)/acpihelp
ACPINAMES =             $(ACPICA_TOOLS)/acpinames
ACPISRC =               $(ACPICA_TOOLS)/acpisrc
ACPIXTRACT =            $(ACPICA_TOOLS)/acpixtract
ASL_COMPILER =          $(ACPICA_SRC)/compiler

#
# Common ACPICA header files
#
ACPICA_HEADERS = \
    $(wildcard $(ACPICA_INCLUDE)/*.h) \
    $(wildcard $(ACPICA_INCLUDE)/platform/*.h)

#
# Common compiler flags
# The _GNU_SOURCE symbol is required for many hosts.
#
OPT_CFLAGS ?= $(CWARNINGFLAGS)

#
# Optionally disable optimizations. Optimization causes problems on
# some compilers such as gcc 4.4
#
ifneq ($(NOOPT),TRUE)
OPT_CFLAGS += -O2
endif

#
# Optionally disable fortify source. This option can cause
# compile errors in toolchains where it is already defined.
#
ifneq ($(NOFORTIFY),TRUE)
OPT_CFLAGS += -D_FORTIFY_SOURCE=2
endif

CFLAGS += \
    -D$(HOST)\
    -D_GNU_SOURCE\
    -I$(ACPICA_INCLUDE)
    
#
# QNX requires __EXT to enable most functions in its C library, analogous
# to _GNU_SOURCE.
#
ifeq ($(HOST), _QNX)
    CFLAGS+=-D__EXT
endif  

#
# Common compiler warning flags. The warning flags in addition
# to -Wall are not automatically included in -Wall.
#
CWARNINGFLAGS = \
    -std=c99\
    -Wall\
    -Wbad-function-cast\
    -Wdeclaration-after-statement\
    -Werror\
    -Wformat=2\
    -Wmissing-declarations\
    -Wmissing-prototypes\
    -Wstrict-aliasing=0\
    -Wstrict-prototypes\
    -Wswitch-default\
    -Wpointer-arith\
    -Wundef

#
# Common gcc 4+ warning flags
#
CWARNINGFLAGS += \
    -Waddress\
    -Waggregate-return\
    -Winit-self\
    -Winline\
    -Wmissing-declarations\
    -Wmissing-field-initializers\
    -Wnested-externs\
    -Wold-style-definition\
    -Wno-format-nonliteral\
    -Wredundant-decls
#
# Per-host flags and exclusions
#
ifneq ($(HOST), _FreeBSD)
    CWARNINGFLAGS += \
        -Wempty-body

    ifneq ($(HOST), _APPLE)
        CWARNINGFLAGS += \
            -Woverride-init\
            -Wlogical-op\
            -Wmissing-parameter-type\
            -Wold-style-declaration\
            -Wtype-limits
    endif
endif

#
# Extra warning flags (for possible future use)
#
#CWARNINGFLAGS += \
#	-Wcast-qual\
#	-Wconversion\
#	-Wshadow\

#
# M4 macro processor is used to build the final parser file
#
# Bison/Flex configuration
#
# -y: act like yacc
#
# -i: generate case insensitive scanner
# -s: suppress default rule, abort on unknown input
#
# Optional for Bison/yacc:
# -v: verbose, produces a .output file
# -d: produces the defines header file
#
# Berkeley yacc configuration
#
#YACC=      byacc
#YFLAGS +=
#
YACC=       bison
YFLAGS +=   -y

MACROPROC=  m4
MFLAGS=     -P -I$(ASL_COMPILER)

LEX=        flex
LFLAGS +=   -i -s