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