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