Merge branch 'mixed-mode' into efi-for-mingo
[linux/fpc-iii.git] / tools / power / acpi / Makefile
blobd9186a2fdf0696f1a319ba6cac0377a66c1fe112
1 # tools/power/acpi/Makefile - ACPI tool Makefile
3 # Copyright (c) 2013, Intel Corporation
4 # Author: Lv Zheng <lv.zheng@intel.com>
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.
11 OUTPUT=./
12 ifeq ("$(origin O)", "command line")
13 OUTPUT := $(O)/
14 endif
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
22 # --- CONFIGURATION BEGIN ---
24 # Set the following to `true' to make a unstripped, unoptimized
25 # binary. Leave this set to `false' for production use.
26 DEBUG ?= true
28 # make the build silent. Set this to something else to make it noisy again.
29 V ?= false
31 # Prefix to the directories we're installing to
32 DESTDIR ?=
34 # --- CONFIGURATION END ---
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
40 bindir ?= /usr/bin
41 sbindir ?= /usr/sbin
42 mandir ?= /usr/man
44 # Toolchain: what tools do we use, and what options do they need:
46 INSTALL = /usr/bin/install -c
47 INSTALL_PROGRAM = ${INSTALL}
48 INSTALL_DATA = ${INSTALL} -m 644
49 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
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
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;}
63 # use '-Os' optimization if available, else use -O2
64 OPTIMIZATION := $(call cc-supports,-Os,-O2)
66 WARNINGS := -Wall
67 WARNINGS += $(call cc-supports,-Wstrict-prototypes)
68 WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
70 KERNEL_INCLUDE := ../../../include
71 CFLAGS += -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
72 CFLAGS += $(WARNINGS)
74 ifeq ($(strip $(V)),false)
75 QUIET=@
76 ECHO=@echo
77 else
78 QUIET=
79 ECHO=@\#
80 endif
81 export QUIET ECHO
83 # if DEBUG is enabled, then we do not strip or optimize
84 ifeq ($(strip $(DEBUG)),true)
85 CFLAGS += -O1 -g -DDEBUG
86 STRIPCMD = /bin/true -Since_we_are_debugging
87 else
88 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
89 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
90 endif
92 # if DEBUG is enabled, then we do not strip or optimize
93 ifeq ($(strip $(DEBUG)),true)
94 CFLAGS += -O1 -g -DDEBUG
95 STRIPCMD = /bin/true -Since_we_are_debugging
96 else
97 CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
98 STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
99 endif
101 # --- ACPIDUMP BEGIN ---
103 vpath %.c \
104 tools/acpidump
106 DUMP_OBJS = \
107 acpidump.o
109 DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS))
111 $(OUTPUT)acpidump: $(DUMP_OBJS)
112 $(ECHO) " LD " $@
113 $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@
114 $(QUIET) $(STRIPCMD) $@
116 $(OUTPUT)tools/acpidump/%.o: %.c
117 $(ECHO) " CC " $@
118 $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
120 # --- ACPIDUMP END ---
122 all: $(OUTPUT)acpidump
123 echo $(OUTPUT)
125 clean:
126 -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
127 | xargs rm -f
128 -rm -f $(OUTPUT)acpidump
130 install-tools:
131 $(INSTALL) -d $(DESTDIR)${bindir}
132 $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
134 install-man:
135 $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
137 install: all install-tools install-man
139 uninstall:
140 - rm -f $(DESTDIR)${sbindir}/acpidump
141 - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
143 .PHONY: all utils install-tools install-man install uninstall clean