]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - tools/power/acpi/Makefile
Merge branch 'acpica'
[karo-tx-linux.git] / tools / power / acpi / Makefile
1 # tools/power/acpi/Makefile - ACPI tool Makefile
2 #
3 # Copyright (c) 2013, Intel Corporation
4 #   Author: Lv Zheng <lv.zheng@intel.com>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; version 2
9 # of the License.
10
11 OUTPUT=./
12 ifeq ("$(origin O)", "command line")
13         OUTPUT := $(O)/
14 endif
15
16 ifneq ($(OUTPUT),)
17 # check that the output directory actually exists
18 OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
19 $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
20 endif
21
22 # --- CONFIGURATION BEGIN ---
23
24 # Set the following to `true' to make a unstripped, unoptimized
25 # binary. Leave this set to `false' for production use.
26 DEBUG ?=        true
27
28 # make the build silent. Set this to something else to make it noisy again.
29 V ?=            false
30
31 # Prefix to the directories we're installing to
32 DESTDIR ?=
33
34 # --- CONFIGURATION END ---
35
36 # Directory definitions. These are default and most probably
37 # do not need to be changed. Please note that DESTDIR is
38 # added in front of any of them
39
40 bindir ?=       /usr/bin
41 sbindir ?=      /usr/sbin
42 mandir ?=       /usr/man
43
44 # Toolchain: what tools do we use, and what options do they need:
45
46 INSTALL = /usr/bin/install -c
47 INSTALL_PROGRAM = ${INSTALL}
48 INSTALL_DATA  = ${INSTALL} -m 644
49 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
50
51 # If you are running a cross compiler, you may want to set this
52 # to something more interesting, like "arm-linux-".  If you want
53 # to compile vs uClibc, that can be done here as well.
54 CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
55 CC = $(CROSS)gcc
56 LD = $(CROSS)gcc
57 STRIP = $(CROSS)strip
58 HOSTCC = gcc
59
60 # check if compiler option is supported
61 cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
62
63 # use '-Os' optimization if available, else use -O2
64 OPTIMIZATION := $(call cc-supports,-Os,-O2)
65
66 WARNINGS := -Wall
67 WARNINGS += $(call cc-supports,-Wstrict-prototypes)
68 WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
69
70 KERNEL_INCLUDE := ../../../include
71 ACPICA_INCLUDE := ../../../drivers/acpi/acpica
72 CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
73 CFLAGS += $(WARNINGS)
74
75 ifeq ($(strip $(V)),false)
76         QUIET=@
77         ECHO=@echo
78 else
79         QUIET=
80         ECHO=@\#
81 endif
82 export QUIET ECHO
83
84 # if DEBUG is enabled, then we do not strip or optimize
85 ifeq ($(strip $(DEBUG)),true)
86         CFLAGS += -O1 -g -DDEBUG
87         STRIPCMD = /bin/true -Since_we_are_debugging
88 else
89         CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
90         STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
91 endif
92
93 # --- ACPIDUMP BEGIN ---
94
95 vpath %.c \
96         ../../../drivers/acpi/acpica\
97         tools/acpidump\
98         common\
99         os_specific/service_layers
100
101 CFLAGS += -DACPI_DUMP_APP -Itools/acpidump
102
103 DUMP_OBJS = \
104         apdump.o\
105         apfiles.o\
106         apmain.o\
107         osunixdir.o\
108         osunixmap.o\
109         tbprint.o\
110         tbxfroot.o\
111         utbuffer.o\
112         utexcep.o\
113         utmath.o\
114         utstring.o\
115         utxferror.o\
116         oslinuxtbl.o\
117         cmfsize.o\
118         getopt.o
119
120 DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS))
121
122 $(OUTPUT)acpidump: $(DUMP_OBJS)
123         $(ECHO) "  LD      " $@
124         $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@
125         $(QUIET) $(STRIPCMD) $@
126
127 $(OUTPUT)tools/acpidump/%.o: %.c
128         $(ECHO) "  CC      " $@
129         $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
130
131 # --- ACPIDUMP END ---
132
133 all: $(OUTPUT)acpidump
134         echo $(OUTPUT)
135
136 clean:
137         -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
138          | xargs rm -f
139         -rm -f $(OUTPUT)acpidump
140
141 install-tools:
142         $(INSTALL) -d $(DESTDIR)${sbindir}
143         $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
144
145 install-man:
146         $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
147
148 install: all install-tools install-man
149
150 uninstall:
151         - rm -f $(DESTDIR)${sbindir}/acpidump
152         - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
153
154 .PHONY: all utils install-tools install-man install uninstall clean