Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 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 | |
Thomas Renninger | d7cddbb | 2014-04-07 15:16:57 +0200 | [diff] [blame] | 22 | SUBDIRS = tools/ec |
| 23 | |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 24 | # --- CONFIGURATION BEGIN --- |
| 25 | |
| 26 | # Set the following to `true' to make a unstripped, unoptimized |
| 27 | # binary. Leave this set to `false' for production use. |
| 28 | DEBUG ?= true |
| 29 | |
| 30 | # make the build silent. Set this to something else to make it noisy again. |
| 31 | V ?= false |
| 32 | |
| 33 | # Prefix to the directories we're installing to |
| 34 | DESTDIR ?= |
| 35 | |
| 36 | # --- CONFIGURATION END --- |
| 37 | |
| 38 | # Directory definitions. These are default and most probably |
| 39 | # do not need to be changed. Please note that DESTDIR is |
| 40 | # added in front of any of them |
| 41 | |
| 42 | bindir ?= /usr/bin |
| 43 | sbindir ?= /usr/sbin |
| 44 | mandir ?= /usr/man |
| 45 | |
| 46 | # Toolchain: what tools do we use, and what options do they need: |
| 47 | |
| 48 | INSTALL = /usr/bin/install -c |
| 49 | INSTALL_PROGRAM = ${INSTALL} |
| 50 | INSTALL_DATA = ${INSTALL} -m 644 |
| 51 | INSTALL_SCRIPT = ${INSTALL_PROGRAM} |
| 52 | |
| 53 | # If you are running a cross compiler, you may want to set this |
| 54 | # to something more interesting, like "arm-linux-". If you want |
| 55 | # to compile vs uClibc, that can be done here as well. |
| 56 | CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- |
| 57 | CC = $(CROSS)gcc |
| 58 | LD = $(CROSS)gcc |
| 59 | STRIP = $(CROSS)strip |
| 60 | HOSTCC = gcc |
| 61 | |
| 62 | # check if compiler option is supported |
| 63 | cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} |
| 64 | |
| 65 | # use '-Os' optimization if available, else use -O2 |
| 66 | OPTIMIZATION := $(call cc-supports,-Os,-O2) |
| 67 | |
| 68 | WARNINGS := -Wall |
| 69 | WARNINGS += $(call cc-supports,-Wstrict-prototypes) |
| 70 | WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) |
| 71 | |
Len Brown | 0efea7b | 2012-09-22 22:33:19 -0400 | [diff] [blame] | 72 | KERNEL_INCLUDE := ../../../include |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 73 | ACPICA_INCLUDE := ../../../drivers/acpi/acpica |
| 74 | CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 75 | CFLAGS += $(WARNINGS) |
Len Brown | 0efea7b | 2012-09-22 22:33:19 -0400 | [diff] [blame] | 76 | |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 77 | ifeq ($(strip $(V)),false) |
| 78 | QUIET=@ |
| 79 | ECHO=@echo |
| 80 | else |
| 81 | QUIET= |
| 82 | ECHO=@\# |
| 83 | endif |
| 84 | export QUIET ECHO |
Len Brown | 0efea7b | 2012-09-22 22:33:19 -0400 | [diff] [blame] | 85 | |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 86 | # if DEBUG is enabled, then we do not strip or optimize |
| 87 | ifeq ($(strip $(DEBUG)),true) |
| 88 | CFLAGS += -O1 -g -DDEBUG |
| 89 | STRIPCMD = /bin/true -Since_we_are_debugging |
| 90 | else |
| 91 | CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer |
| 92 | STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment |
| 93 | endif |
Len Brown | 0efea7b | 2012-09-22 22:33:19 -0400 | [diff] [blame] | 94 | |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 95 | # --- ACPIDUMP BEGIN --- |
Len Brown | 0e7cc27 | 2012-09-22 23:30:22 -0400 | [diff] [blame] | 96 | |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 97 | vpath %.c \ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 98 | ../../../drivers/acpi/acpica\ |
| 99 | tools/acpidump\ |
| 100 | common\ |
| 101 | os_specific/service_layers |
| 102 | |
| 103 | CFLAGS += -DACPI_DUMP_APP -Itools/acpidump |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 104 | |
| 105 | DUMP_OBJS = \ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 106 | apdump.o\ |
| 107 | apfiles.o\ |
| 108 | apmain.o\ |
| 109 | osunixdir.o\ |
| 110 | osunixmap.o\ |
Lv Zheng | 83b80bac | 2014-07-08 10:06:45 +0800 | [diff] [blame] | 111 | osunixxf.o\ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 112 | tbprint.o\ |
| 113 | tbxfroot.o\ |
| 114 | utbuffer.o\ |
Lv Zheng | 3c9349c | 2014-07-08 10:07:19 +0800 | [diff] [blame] | 115 | utdebug.o\ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 116 | utexcep.o\ |
Lv Zheng | e8c038a | 2014-07-08 10:06:39 +0800 | [diff] [blame] | 117 | utglobal.o\ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 118 | utmath.o\ |
Lv Zheng | 3c9349c | 2014-07-08 10:07:19 +0800 | [diff] [blame] | 119 | utprint.o\ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 120 | utstring.o\ |
| 121 | utxferror.o\ |
Lv Zheng | 3c9349c | 2014-07-08 10:07:19 +0800 | [diff] [blame] | 122 | oslibcfs.o\ |
Lv Zheng | edbe47c | 2014-04-04 12:39:56 +0800 | [diff] [blame] | 123 | oslinuxtbl.o\ |
| 124 | cmfsize.o\ |
| 125 | getopt.o |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 126 | |
| 127 | DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS)) |
| 128 | |
| 129 | $(OUTPUT)acpidump: $(DUMP_OBJS) |
| 130 | $(ECHO) " LD " $@ |
| 131 | $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@ |
| 132 | $(QUIET) $(STRIPCMD) $@ |
| 133 | |
| 134 | $(OUTPUT)tools/acpidump/%.o: %.c |
| 135 | $(ECHO) " CC " $@ |
| 136 | $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< |
| 137 | |
| 138 | # --- ACPIDUMP END --- |
| 139 | |
| 140 | all: $(OUTPUT)acpidump |
| 141 | echo $(OUTPUT) |
| 142 | |
| 143 | clean: |
| 144 | -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ |
| 145 | | xargs rm -f |
| 146 | -rm -f $(OUTPUT)acpidump |
| 147 | |
| 148 | install-tools: |
Thomas Renninger | 75e4f20 | 2014-04-07 15:16:54 +0200 | [diff] [blame] | 149 | $(INSTALL) -d $(DESTDIR)${sbindir} |
Lv Zheng | f677b30 | 2014-01-15 12:04:09 +0800 | [diff] [blame] | 150 | $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir} |
| 151 | |
| 152 | install-man: |
| 153 | $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8 |
| 154 | |
| 155 | install: all install-tools install-man |
| 156 | |
| 157 | uninstall: |
| 158 | - rm -f $(DESTDIR)${sbindir}/acpidump |
| 159 | - rm -f $(DESTDIR)${mandir}/man8/acpidump.8 |
| 160 | |
| 161 | .PHONY: all utils install-tools install-man install uninstall clean |