Sync ACPICA with Intel's version 20161222.
[dragonfly.git] / sys / contrib / dev / acpica / generate / unix / Makefile.config
blobda0f61d5147c05fae6c2b3c9e227eaf876d51adc
2 # Makefile.config
4 # Common configuration and setup file to generate the ACPICA tools and
5 # utilities: the iASL compiler, acpiexec, acpihelp, acpinames, acpisrc,
6 # acpixtract, acpibin.
8 # This file is included by the individual makefiles for each tool.
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.
21 # Configuration
23 # OPT_CFLAGS can be overridden on the make command line by
24 #   adding OPT_CFLAGS="..." to the invocation.
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.
35 .SUFFIXES :
36 PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
37 HOST ?= _CYGWIN
38 CC =    gcc
41 # Common defines
43 OBJDIR =     obj
44 BINDIR =     bin
45 COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<
46 LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)
47 PREFIX ?=    /usr
48 INSTALLDIR = $(PREFIX)/bin
49 UNAME_S := $(shell uname -s)
52 # Host detection and configuration
54 ifeq ($(UNAME_S), Darwin)  # Mac OS X
55 HOST =       _APPLE
56 endif
58 ifeq ($(UNAME_S), DragonFly)
59 HOST =       _DragonFly
60 endif
62 ifeq ($(UNAME_S), FreeBSD)
63 HOST =       _FreeBSD
64 endif
66 ifeq ($(UNAME_S), NetBSD)
67 HOST =       _NetBSD
68 endif
70 ifeq ($(UNAME_S), QNX)
71 HOST =       _QNX
72 endif
74 ifeq ($(HOST), _APPLE)
75 INSTALL  =   cp
76 INSTALLFLAGS ?= -f
77 else
78 INSTALL =    install
79 INSTALLFLAGS ?= -m 555 -s
80 endif
82 INSTALLPROG = \
83         mkdir -p $(DESTDIR)$(INSTALLDIR); \
84         $(INSTALL) $(INSTALLFLAGS) ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG)
87 # Rename a .exe file if necessary
89 RENAMEPROG = \
90         @if [ -e "$(PROG).exe" ] ; then \
91                 mv $(PROG).exe $(PROG); \
92                 echo "Renamed $(PROG).exe to $(PROG)"; \
93         fi;
96 # Copy the final executable to the local bin directory
98 COPYPROG = \
99         @mkdir -p ../$(BINDIR); \
100         cp -f $(PROG) ../$(BINDIR); \
101         echo "Copied $(PROG) to $(FINAL_PROG)";
104 # Main ACPICA source directories
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
125 # ACPICA tool and utility source directories
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 ACPINAMES =             $(ACPICA_TOOLS)/acpinames
133 ACPISRC =               $(ACPICA_TOOLS)/acpisrc
134 ACPIXTRACT =            $(ACPICA_TOOLS)/acpixtract
135 ASL_COMPILER =          $(ACPICA_SRC)/compiler
138 # Common ACPICA header files
140 ACPICA_HEADERS = \
141     $(wildcard $(ACPICA_INCLUDE)/*.h) \
142     $(wildcard $(ACPICA_INCLUDE)/platform/*.h)
145 # Common compiler flags
146 # The _GNU_SOURCE symbol is required for many hosts.
148 OPT_CFLAGS ?= $(CWARNINGFLAGS)
151 # Optionally disable optimizations. Optimization causes problems on
152 # some compilers such as gcc 4.4
154 ifneq ($(NOOPT),TRUE)
155 OPT_CFLAGS += -O2
156 endif
159 # Optionally disable fortify source. This option can cause
160 # compile errors in toolchains where it is already defined.
162 ifneq ($(NOFORTIFY),TRUE)
163 OPT_CFLAGS += -D_FORTIFY_SOURCE=2
164 endif
166 CFLAGS += \
167     -D$(HOST)\
168     -D_GNU_SOURCE\
169     -I$(ACPICA_INCLUDE)
170     
172 # QNX requires __EXT to enable most functions in its C library, analogous
173 # to _GNU_SOURCE.
175 ifeq ($(HOST), _QNX)
176     CFLAGS+=-D__EXT
177 endif  
180 # Common compiler warning flags. The warning flags in addition
181 # to -Wall are not automatically included in -Wall.
183 CWARNINGFLAGS = \
184     -std=c99\
185     -Wall\
186     -Wbad-function-cast\
187     -Wdeclaration-after-statement\
188     -Werror\
189     -Wformat=2\
190     -Wmissing-declarations\
191     -Wmissing-prototypes\
192     -Wstrict-aliasing=0\
193     -Wstrict-prototypes\
194     -Wswitch-default\
195     -Wpointer-arith\
196     -Wundef
199 # Common gcc 4+ warning flags
201 CWARNINGFLAGS += \
202     -Waddress\
203     -Waggregate-return\
204     -Winit-self\
205     -Winline\
206     -Wmissing-declarations\
207     -Wmissing-field-initializers\
208     -Wnested-externs\
209     -Wold-style-definition\
210     -Wno-format-nonliteral\
211     -Wredundant-decls
213 # Per-host flags and exclusions
215 ifneq ($(HOST), _FreeBSD)
216     CWARNINGFLAGS += \
217         -Wempty-body
219     ifneq ($(HOST), _APPLE)
220         CWARNINGFLAGS += \
221             -Woverride-init\
222             -Wlogical-op\
223             -Wmissing-parameter-type\
224             -Wold-style-declaration\
225             -Wtype-limits
226     endif
227 endif
230 # Extra warning flags (for possible future use)
232 #CWARNINGFLAGS += \
233 #       -Wcast-qual\
234 #       -Wconversion\
235 #       -Wshadow\
238 # M4 macro processor is used to build the final parser file
240 # Bison/Flex configuration
242 # -y: act like yacc
244 # -i: generate case insensitive scanner
245 # -s: suppress default rule, abort on unknown input
247 # Optional for Bison/yacc:
248 # -v: verbose, produces a .output file
249 # -d: produces the defines header file
251 # Berkeley yacc configuration
253 #YACC=      byacc
254 #YFLAGS +=
256 YACC=       bison
257 YFLAGS +=   -y
259 MACROPROC=  m4
260 MFLAGS=     -P -I$(ASL_COMPILER)
262 LEX=        flex
263 LFLAGS +=   -i -s