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