diff options
author | Lv Zheng <lv.zheng@intel.com> | 2015-07-28 01:25:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-07-31 17:39:31 -0400 |
commit | 391fc234b543991dd7d0361e634cdf5abfbdd0a3 (patch) | |
tree | 6fee9fb834b018ed67b85201f9b064d783c6bbeb | |
parent | 40913fe6ea3b733564f0b580cf6c51f5d8fa8158 (diff) |
tools/power/acpi: Add descend support in ACPI tools Makefile
This patch splits tools/power/acpi/Makefile to support descend compling for
ACPI tools. In this patch tools/ec related stuff is removed as it is
originally not enabled.
Also a missing .o (utnonansi.o) is added to the acpidump/Makefile.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | tools/power/acpi/Makefile | 168 | ||||
-rw-r--r-- | tools/power/acpi/Makefile.config | 92 | ||||
-rw-r--r-- | tools/power/acpi/Makefile.rules | 37 | ||||
-rw-r--r-- | tools/power/acpi/tools/acpidump/Makefile | 53 |
4 files changed, 199 insertions, 151 deletions
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile index 3d1537b93c64..3d052377b440 100644 --- a/tools/power/acpi/Makefile +++ b/tools/power/acpi/Makefile | |||
@@ -8,154 +8,20 @@ | |||
8 | # as published by the Free Software Foundation; version 2 | 8 | # as published by the Free Software Foundation; version 2 |
9 | # of the License. | 9 | # of the License. |
10 | 10 | ||
11 | OUTPUT=./ | 11 | include ../../scripts/Makefile.include |
12 | ifeq ("$(origin O)", "command line") | 12 | |
13 | OUTPUT := $(O)/ | 13 | all: acpidump |
14 | endif | 14 | clean: acpidump_clean |
15 | 15 | install: acpidump_install | |
16 | ifneq ($(OUTPUT),) | 16 | uninstall: acpidump_uninstall |
17 | # check that the output directory actually exists | 17 | |
18 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | 18 | acpidump: FORCE |
19 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | 19 | $(call descend,tools/$@,all) |
20 | endif | 20 | acpidump_clean: |
21 | 21 | $(call descend,tools/$(@:_clean=),clean) | |
22 | SUBDIRS = tools/ec | 22 | acpidump_install: |
23 | 23 | $(call descend,tools/$(@:_install=),install) | |
24 | # --- CONFIGURATION BEGIN --- | 24 | acpidump_uninstall: |
25 | 25 | $(call descend,tools/$(@:_uninstall=),uninstall) | |
26 | # Set the following to `true' to make a unstripped, unoptimized | 26 | |
27 | # binary. Leave this set to `false' for production use. | 27 | .PHONY: FORCE |
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 | |||
72 | KERNEL_INCLUDE := ../../../include | ||
73 | ACPICA_INCLUDE := ../../../drivers/acpi/acpica | ||
74 | CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) | ||
75 | CFLAGS += $(WARNINGS) | ||
76 | |||
77 | ifeq ($(strip $(V)),false) | ||
78 | QUIET=@ | ||
79 | ECHO=@echo | ||
80 | else | ||
81 | QUIET= | ||
82 | ECHO=@\# | ||
83 | endif | ||
84 | export QUIET ECHO | ||
85 | |||
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 | ||
94 | |||
95 | # --- ACPIDUMP BEGIN --- | ||
96 | |||
97 | vpath %.c \ | ||
98 | ../../../drivers/acpi/acpica\ | ||
99 | tools/acpidump\ | ||
100 | common\ | ||
101 | os_specific/service_layers | ||
102 | |||
103 | CFLAGS += -DACPI_DUMP_APP -Itools/acpidump | ||
104 | |||
105 | DUMP_OBJS = \ | ||
106 | apdump.o\ | ||
107 | apfiles.o\ | ||
108 | apmain.o\ | ||
109 | osunixdir.o\ | ||
110 | osunixmap.o\ | ||
111 | osunixxf.o\ | ||
112 | tbprint.o\ | ||
113 | tbxfroot.o\ | ||
114 | utbuffer.o\ | ||
115 | utdebug.o\ | ||
116 | utexcep.o\ | ||
117 | utglobal.o\ | ||
118 | utmath.o\ | ||
119 | utprint.o\ | ||
120 | utstring.o\ | ||
121 | utxferror.o\ | ||
122 | oslibcfs.o\ | ||
123 | oslinuxtbl.o\ | ||
124 | cmfsize.o\ | ||
125 | getopt.o | ||
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: | ||
149 | $(INSTALL) -d $(DESTDIR)${sbindir} | ||
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 | ||
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config new file mode 100644 index 000000000000..552af68d5414 --- /dev/null +++ b/tools/power/acpi/Makefile.config | |||
@@ -0,0 +1,92 @@ | |||
1 | # tools/power/acpi/Makefile.config - ACPI tool Makefile | ||
2 | # | ||
3 | # Copyright (c) 2015, 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 | include ../../../../scripts/Makefile.include | ||
12 | |||
13 | OUTPUT=./ | ||
14 | ifeq ("$(origin O)", "command line") | ||
15 | OUTPUT := $(O)/ | ||
16 | endif | ||
17 | |||
18 | ifneq ($(OUTPUT),) | ||
19 | # check that the output directory actually exists | ||
20 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | ||
21 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | ||
22 | endif | ||
23 | |||
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 | |||
72 | KERNEL_INCLUDE := ../../../include | ||
73 | ACPICA_INCLUDE := ../../../drivers/acpi/acpica | ||
74 | CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) | ||
75 | CFLAGS += $(WARNINGS) | ||
76 | |||
77 | ifeq ($(strip $(V)),false) | ||
78 | QUIET=@ | ||
79 | ECHO=@echo | ||
80 | else | ||
81 | QUIET= | ||
82 | ECHO=@\# | ||
83 | endif | ||
84 | |||
85 | # if DEBUG is enabled, then we do not strip or optimize | ||
86 | ifeq ($(strip $(DEBUG)),true) | ||
87 | CFLAGS += -O1 -g -DDEBUG | ||
88 | STRIPCMD = /bin/true -Since_we_are_debugging | ||
89 | else | ||
90 | CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer | ||
91 | STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment | ||
92 | endif | ||
diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules new file mode 100644 index 000000000000..ec87a9e562c0 --- /dev/null +++ b/tools/power/acpi/Makefile.rules | |||
@@ -0,0 +1,37 @@ | |||
1 | # tools/power/acpi/Makefile.rules - ACPI tool Makefile | ||
2 | # | ||
3 | # Copyright (c) 2015, 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)$(TOOL): $(TOOL_OBJS) FORCE | ||
12 | $(ECHO) " LD " $@ | ||
13 | $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(TOOL_OBJS) -L$(OUTPUT) -o $@ | ||
14 | $(QUIET) $(STRIPCMD) $@ | ||
15 | |||
16 | $(OUTPUT)%.o: %.c | ||
17 | $(ECHO) " CC " $@ | ||
18 | $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< | ||
19 | |||
20 | all: $(OUTPUT)$(TOOL) | ||
21 | clean: | ||
22 | -find $(OUTPUT) \( -not -type d \) \ | ||
23 | -and \( -name '*~' -o -name '*.[oas]' \) \ | ||
24 | -type f -print \ | ||
25 | | xargs rm -f | ||
26 | -rm -f $(OUTPUT)$(TOOL) | ||
27 | |||
28 | install-tools: | ||
29 | $(INSTALL) -d $(DESTDIR)${sbindir} | ||
30 | $(INSTALL_PROGRAM) $(OUTPUT)$(TOOL) $(DESTDIR)${sbindir} | ||
31 | uninstall-tools: | ||
32 | - rm -f $(DESTDIR)${sbindir}/$(TOOL) | ||
33 | |||
34 | install: all install-tools $(EXTRA_INSTALL) | ||
35 | uninstall: uninstall-tools $(EXTRA_UNINSTALL) | ||
36 | |||
37 | .PHONY: FORCE | ||
diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile new file mode 100644 index 000000000000..8d761576e91b --- /dev/null +++ b/tools/power/acpi/tools/acpidump/Makefile | |||
@@ -0,0 +1,53 @@ | |||
1 | # tools/power/acpi/tools/acpidump/Makefile - ACPI tool Makefile | ||
2 | # | ||
3 | # Copyright (c) 2015, 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 | include ../../Makefile.config | ||
12 | |||
13 | TOOL = acpidump | ||
14 | EXTRA_INSTALL = install-man | ||
15 | EXTRA_UNINSTALL = uninstall-man | ||
16 | |||
17 | vpath %.c \ | ||
18 | ../../../../../drivers/acpi/acpica\ | ||
19 | ./\ | ||
20 | ../../common\ | ||
21 | ../../os_specific/service_layers | ||
22 | CFLAGS += -DACPI_DUMP_APP -I.\ | ||
23 | -I../../../../../drivers/acpi/acpica\ | ||
24 | -I../../../../../include | ||
25 | TOOL_OBJS = \ | ||
26 | apdump.o\ | ||
27 | apfiles.o\ | ||
28 | apmain.o\ | ||
29 | osunixdir.o\ | ||
30 | osunixmap.o\ | ||
31 | osunixxf.o\ | ||
32 | tbprint.o\ | ||
33 | tbxfroot.o\ | ||
34 | utbuffer.o\ | ||
35 | utdebug.o\ | ||
36 | utexcep.o\ | ||
37 | utglobal.o\ | ||
38 | utmath.o\ | ||
39 | utnonansi.o\ | ||
40 | utprint.o\ | ||
41 | utstring.o\ | ||
42 | utxferror.o\ | ||
43 | oslibcfs.o\ | ||
44 | oslinuxtbl.o\ | ||
45 | cmfsize.o\ | ||
46 | getopt.o | ||
47 | |||
48 | include ../../Makefile.rules | ||
49 | |||
50 | install-man: ../../man/acpidump.8 | ||
51 | $(INSTALL_DATA) -D $< $(DESTDIR)${mandir}/man8/acpidump.8 | ||
52 | uninstall-man: | ||
53 | - rm -f $(DESTDIR)${mandir}/man8/acpidump.8 | ||