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