1#
2# Makefile.config
3#
4# Common configuration and setup file to generate the ACPICA tools and
5# utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc,
6# acpixtract, 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 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.
34#
35.SUFFIXES :
36PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
37HOST ?= _CYGWIN
38CC =    gcc
39
40#
41# Common defines
42#
43OBJDIR =     obj
44BINDIR =     bin
45COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
46LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
47PREFIX ?=    /usr
48INSTALLDIR = $(PREFIX)/bin
49
50ifeq ($(HOST), _APPLE)
51INSTALL  =   cp
52INSTALLFLAGS ?= -f
53else
54INSTALL =    install
55INSTALLFLAGS ?= -m 555 -s
56endif
57
58INSTALLPROG = \
59	mkdir -p $(DESTDIR)$(INSTALLDIR); \
60	$(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
61
62#
63# Rename a .exe file if necessary
64#
65RENAMEPROG = \
66	@if [ -e "$(PROG).exe" ] ; then \
67		mv $(PROG).exe $(PROG); \
68		echo "Renamed $(PROG).exe to $(PROG)"; \
69	fi;
70
71#
72# Copy the final executable to the local bin directory
73#
74COPYPROG = \
75	@mkdir -p ../$(BINDIR); \
76	cp -f $(PROG) ../$(BINDIR); \
77	echo "Copied $(PROG) to $(FINAL_PROG)";
78
79#
80# Main ACPICA source directories
81#
82ACPICA_SRC =            ../../../source
83ACPICA_COMMON =         $(ACPICA_SRC)/common
84ACPICA_TOOLS =          $(ACPICA_SRC)/tools
85ACPICA_OSL =            $(ACPICA_SRC)/os_specific/service_layers
86ACPICA_CORE =           $(ACPICA_SRC)/components
87ACPICA_INCLUDE =        $(ACPICA_SRC)/include
88ACPICA_DEBUGGER =       $(ACPICA_CORE)/debugger
89ACPICA_DISASSEMBLER =   $(ACPICA_CORE)/disassembler
90ACPICA_DISPATCHER =     $(ACPICA_CORE)/dispatcher
91ACPICA_EVENTS =         $(ACPICA_CORE)/events
92ACPICA_EXECUTER =       $(ACPICA_CORE)/executer
93ACPICA_HARDWARE =       $(ACPICA_CORE)/hardware
94ACPICA_NAMESPACE =      $(ACPICA_CORE)/namespace
95ACPICA_PARSER =         $(ACPICA_CORE)/parser
96ACPICA_RESOURCES =      $(ACPICA_CORE)/resources
97ACPICA_TABLES =         $(ACPICA_CORE)/tables
98ACPICA_UTILITIES =      $(ACPICA_CORE)/utilities
99
100#
101# ACPICA tool and utility source directories
102#
103ACPIBIN =               $(ACPICA_TOOLS)/acpibin
104ACPIDUMP =              $(ACPICA_TOOLS)/acpidump
105ACPIEXAMPLES =          $(ACPICA_TOOLS)/examples
106ACPIEXEC =              $(ACPICA_TOOLS)/acpiexec
107ACPIHELP =              $(ACPICA_TOOLS)/acpihelp
108ACPINAMES =             $(ACPICA_TOOLS)/acpinames
109ACPISRC =               $(ACPICA_TOOLS)/acpisrc
110ACPIXTRACT =            $(ACPICA_TOOLS)/acpixtract
111ASL_COMPILER =          $(ACPICA_SRC)/compiler
112
113#
114# Common ACPICA header files
115#
116ACPICA_HEADERS = \
117    $(wildcard $(ACPICA_INCLUDE)/*.h) \
118    $(wildcard $(ACPICA_INCLUDE)/platform/*.h)
119
120#
121# Common compiler flags
122# The _GNU_SOURCE symbol is required for many hosts.
123#
124OPT_CFLAGS ?= $(CWARNINGFLAGS)
125
126#
127# Optionally disable optimizations. Optimization causes problems on
128# some compilers such as gcc 4.4
129#
130ifneq ($(NOOPT),TRUE)
131OPT_CFLAGS += -O2 -D_FORTIFY_SOURCE=2
132endif
133
134CFLAGS += \
135    -D$(HOST)\
136    -D_GNU_SOURCE\
137    -I$(ACPICA_INCLUDE)
138
139#
140# Common compiler warning flags. The warning flags in addition
141# to -Wall are not automatically included in -Wall.
142#
143CWARNINGFLAGS = \
144    -ansi\
145    -Wall\
146    -Wbad-function-cast\
147    -Wdeclaration-after-statement\
148    -Werror\
149    -Wformat=2\
150    -Wmissing-declarations\
151    -Wmissing-prototypes\
152    -Wstrict-aliasing=0\
153    -Wstrict-prototypes\
154    -Wswitch-default\
155    -Wpointer-arith\
156    -Wundef
157
158#
159# Common gcc 4+ warning flags
160#
161CWARNINGFLAGS += \
162    -Waddress\
163    -Waggregate-return\
164    -Wchar-subscripts\
165    -Wmissing-declarations\
166    -Wmissing-field-initializers\
167    -Wnested-externs\
168    -Wold-style-definition\
169    -Wno-format-nonliteral\
170    -Wredundant-decls
171
172#
173# Per-host flags and exclusions
174#
175ifneq ($(HOST), _FreeBSD)
176    CWARNINGFLAGS += \
177        -Wempty-body
178
179    ifneq ($(HOST), _APPLE)
180        CWARNINGFLAGS += \
181        -Wlogical-op\
182        -Wmissing-parameter-type\
183        -Wold-style-declaration\
184        -Wtype-limits
185    endif
186endif
187
188#
189# Extra warning flags (for possible future use)
190#
191#CWARNINGFLAGS += \
192#	-Wcast-qual\
193#	-Wconversion\
194#	-Wshadow\
195
196#
197# Bison/Flex configuration
198#
199# -y: act like yacc
200#
201# -i: generate case insensitive scanner
202# -s: suppress default rule, abort on unknown input
203#
204# Optional for Bison/yacc:
205# -v: verbose, produces a .output file
206# -d: produces the defines header file
207#
208# Berkeley yacc configuration
209#
210#YACC=      byacc
211#YFLAGS +=
212#
213YACC=       bison
214YFLAGS +=   -y
215
216LEX=        flex
217LFLAGS +=   -i -s
218
219