From: Thomas Renninger <trenn@suse.de>
To: rjw@rjwysocki.net
Cc: lv.zheng@intel.com, linux-acpi@vger.kernel.org,
Thomas Renninger <trenn@suse.de>
Subject: [PATCH 2/4] tools/power/acpi: Make makefile work per subdirectory
Date: Mon, 7 Apr 2014 15:16:55 +0200 [thread overview]
Message-ID: <1396876617-53345-3-git-send-email-trenn@suse.de> (raw)
In-Reply-To: <1396876617-53345-1-git-send-email-trenn@suse.de>
Not sure why such a huge Makefile is needed to compile one file...
Anyway, I splitted up general variables/info and kept them in main
tools/power/acpi/Makefile
And created a new acpidump specific Makefile inside:
tools/power/acpi/tools/acpidump/Makefile
While this already is a cleanup worth by itself, I will add a new
tool making use of this new structure with a follow up submit.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
tools/power/acpi/Makefile | 94 +++++++++---------------------
tools/power/acpi/tools/acpidump/Makefile | 27 +++++++++
2 files changed, 55 insertions(+), 66 deletions(-)
create mode 100644 tools/power/acpi/tools/acpidump/Makefile
diff --git a/tools/power/acpi/Makefile b/tools/power/acpi/Makefile
index c2c0f20..d97dada 100644
--- a/tools/power/acpi/Makefile
+++ b/tools/power/acpi/Makefile
@@ -8,28 +8,19 @@
# as published by the Free Software Foundation; version 2
# of the License.
-OUTPUT=./
-ifeq ("$(origin O)", "command line")
- OUTPUT := $(O)/
-endif
-
-ifneq ($(OUTPUT),)
-# check that the output directory actually exists
-OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
-$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
-endif
+SUBDIRS = tools/acpidump
# --- CONFIGURATION BEGIN ---
# Set the following to `true' to make a unstripped, unoptimized
# binary. Leave this set to `false' for production use.
-DEBUG ?= true
+export DEBUG ?= true
# make the build silent. Set this to something else to make it noisy again.
V ?= false
# Prefix to the directories we're installing to
-DESTDIR ?=
+export DESTDIR ?=
# --- CONFIGURATION END ---
@@ -37,39 +28,37 @@ DESTDIR ?=
# do not need to be changed. Please note that DESTDIR is
# added in front of any of them
-bindir ?= /usr/bin
-sbindir ?= /usr/sbin
-mandir ?= /usr/man
+export bindir ?= /usr/bin
+export sbindir ?= /usr/sbin
+export mandir ?= /usr/man
# Toolchain: what tools do we use, and what options do they need:
-INSTALL = /usr/bin/install -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+export INSTALL = /usr/bin/install -c
+export INSTALL_PROGRAM = ${INSTALL}
+export INSTALL_DATA = ${INSTALL} -m 644
+export INSTALL_SCRIPT = ${INSTALL_PROGRAM}
# If you are running a cross compiler, you may want to set this
# to something more interesting, like "arm-linux-". If you want
# to compile vs uClibc, that can be done here as well.
-CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
-CC = $(CROSS)gcc
-LD = $(CROSS)gcc
-STRIP = $(CROSS)strip
-HOSTCC = gcc
+export CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
+export CC = $(CROSS)gcc
+export LD = $(CROSS)gcc
+export STRIP = $(CROSS)strip
+export HOSTCC = gcc
# check if compiler option is supported
cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
# use '-Os' optimization if available, else use -O2
-OPTIMIZATION := $(call cc-supports,-Os,-O2)
+export OPTIMIZATION := $(call cc-supports,-Os,-O2)
-WARNINGS := -Wall
+export WARNINGS := -Wall
WARNINGS += $(call cc-supports,-Wstrict-prototypes)
WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
-KERNEL_INCLUDE := ../../../include
-CFLAGS += -D_LINUX -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
-CFLAGS += $(WARNINGS)
+export CFLAGS += $(WARNINGS)
ifeq ($(strip $(V)),false)
QUIET=@
@@ -83,52 +72,25 @@ export QUIET ECHO
# if DEBUG is enabled, then we do not strip or optimize
ifeq ($(strip $(DEBUG)),true)
CFLAGS += -O1 -g -DDEBUG
- STRIPCMD = /bin/true -Since_we_are_debugging
+ export STRIPCMD = /bin/true -Since_we_are_debugging
else
CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer
- STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
+ export STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment
endif
-# --- ACPIDUMP BEGIN ---
-
-vpath %.c \
- tools/acpidump
-
-DUMP_OBJS = \
- acpidump.o
-
-DUMP_OBJS := $(addprefix $(OUTPUT)tools/acpidump/,$(DUMP_OBJS))
+all: $(SUBDIRS)
+ $(foreach dir,$(SUBDIRS),make -C $(dir);)
-$(OUTPUT)acpidump: $(DUMP_OBJS)
- $(ECHO) " LD " $@
- $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $(DUMP_OBJS) -L$(OUTPUT) -o $@
- $(QUIET) $(STRIPCMD) $@
-
-$(OUTPUT)tools/acpidump/%.o: %.c
- $(ECHO) " CC " $@
- $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
-
-# --- ACPIDUMP END ---
-
-all: $(OUTPUT)acpidump
- echo $(OUTPUT)
clean:
- -find $(OUTPUT) \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
+ -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \
| xargs rm -f
- -rm -f $(OUTPUT)acpidump
-
-install-tools:
- $(INSTALL) -d $(DESTDIR)${sbindir}
- $(INSTALL_PROGRAM) $(OUTPUT)acpidump $(DESTDIR)${sbindir}
-
-install-man:
- $(INSTALL_DATA) -D man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
+ $(foreach dir,$(SUBDIRS),make -C $(dir) clean;)
-install: all install-tools install-man
+install:
+ $(foreach dir,$(SUBDIRS),make -C $(dir) install;)
uninstall:
- - rm -f $(DESTDIR)${sbindir}/acpidump
- - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
+ $(foreach dir,$(SUBDIRS),make -C $(dir) uninstall;)
-.PHONY: all utils install-tools install-man install uninstall clean
+.PHONY: all install uninstall clean
diff --git a/tools/power/acpi/tools/acpidump/Makefile b/tools/power/acpi/tools/acpidump/Makefile
new file mode 100644
index 0000000..4d0f993
--- /dev/null
+++ b/tools/power/acpi/tools/acpidump/Makefile
@@ -0,0 +1,27 @@
+KERNEL_INCLUDE := ../../../../../include
+CFLAGS += -D_LINUX -DACPI_USE_SYSTEM_INTTYPES=0 -DDEFINE_ALTERNATE_TYPES -I$(KERNEL_INCLUDE)
+
+acpidump: acpidump.o
+ $(ECHO) " LD " $@
+ $(QUIET) $(LD) $(CFLAGS) $(LDFLAGS) $< -o $@
+ $(QUIET) $(STRIPCMD) $@
+
+%.o: %.c
+ $(ECHO) " CC " $@
+ $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
+
+all: acpidump
+
+install:
+ $(INSTALL) -d $(DESTDIR)${sbindir}
+ $(INSTALL_PROGRAM) acpidump $(DESTDIR)${sbindir}
+ $(INSTALL_DATA) -D ../../man/acpidump.8 $(DESTDIR)${mandir}/man8/acpidump.8
+
+uninstall:
+ - rm -f $(DESTDIR)${sbindir}/acpidump
+ - rm -f $(DESTDIR)${mandir}/man8/acpidump.8
+
+clean:
+ -rm -f $(OUTPUT)acpidump
+
+.PHONY: all install uninstall
--
1.7.6.1
next prev parent reply other threads:[~2014-04-07 13:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-07 13:16 Introduce acpi_validate and ec_acces in tools/power/acpi Thomas Renninger
2014-04-07 13:16 ` [PATCH 1/4] tools/power/acpi: Minor bugfixes Thomas Renninger
2014-04-08 2:19 ` Zheng, Lv
2014-04-21 21:10 ` Rafael J. Wysocki
2014-04-07 13:16 ` Thomas Renninger [this message]
2014-04-08 1:58 ` [PATCH 2/4] tools/power/acpi: Make makefile work per subdirectory Zheng, Lv
2014-04-07 13:16 ` [PATCH 3/4] tools/power/acpi: Introduce acpi_validate with manpage for easy validation of ACPI BIOS tables Thomas Renninger
2014-04-08 2:34 ` Zheng, Lv
2014-04-07 13:16 ` [PATCH 4/4] tools/power/acpi: Introduce ec_access.c - tool to access the Embedded Controller (EC) safely for debugging purposes Thomas Renninger
2014-04-08 2:09 ` Introduce acpi_validate and ec_acces in tools/power/acpi Zheng, Lv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396876617-53345-3-git-send-email-trenn@suse.de \
--to=trenn@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).