From: Eric Sandeen <sandeen@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] Btrfs-progs: Add Makefile infrastructure for subdirs
Date: Tue, 11 Jun 2013 18:15:17 -0500 [thread overview]
Message-ID: <1370992519-21369-2-git-send-email-sandeen@redhat.com> (raw)
In-Reply-To: <1370992519-21369-1-git-send-email-sandeen@redhat.com>
Preparatory patch to move cmd & test files into their
own subdirs.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Makefile | 38 +++++++++++++++++++++++++++++++-------
man/Makefile | 1 -
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index 7a49174..5411ad9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+# Export all variables to sub-makes by default
+export
+
CC = gcc
LN = ln
AR = ar
@@ -53,6 +56,18 @@ btrfs_convert_libs = -lext2fs -lcom_err
btrfs_image_libs = -lpthread
btrfs_fragment_libs = -lgd -lpng -ljpeg -lfreetype
+SUBDIRS = man
+BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
+INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
+CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
+
+.PHONY: $(SUBDIRS)
+.PHONY: $(BUILDDIRS)
+.PHONY: $(INSTALLDIRS)
+.PHONY: $(TESTDIRS)
+.PHONY: $(CLEANDIRS)
+.PHONY: all install clean
+
# Create all the static targets
static_objects = $(patsubst %.o, %.static.o, $(objects))
static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
@@ -85,7 +100,11 @@ endif
@echo " [CC] $@"
$(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
-all: version.h $(progs) manpages
+all: version.h $(progs) $(BUILDDIRS)
+$(SUBDIRS): $(BUILDDIRS)
+$(BUILDDIRS):
+ @echo "Making all in $(patsubst build-%,%,$@)"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst build-%,%,$@)
#
# NOTE: For static compiles, you need to have all the required libs
@@ -178,19 +197,19 @@ send-test: $(objects) $(libs) send-test.o
manpages:
$(Q)$(MAKE) $(MAKEOPTS) -C man
-install-man:
- cd man; $(MAKE) install
-
-clean :
+clean: $(CLEANDIRS)
@echo "Cleaning"
$(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfsck \
btrfs.static mkfs.btrfs.static btrfs-calc-size \
version.h \
$(libs) $(lib_links)
- $(Q)$(MAKE) $(MAKEOPTS) -C man $@
-install: $(libs) $(progs) install-man
+$(CLEANDIRS):
+ @echo "Cleaning $(patsubst clean-%,%,$@)"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst clean-%,%,$@) clean
+
+install: $(libs) $(progs) $(INSTALLDIRS)
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
$(INSTALL) $(progs) $(DESTDIR)$(bindir)
# btrfsck is a link to btrfs in the src tree, make it so for installed file as well
@@ -201,4 +220,9 @@ install: $(libs) $(progs) install-man
$(INSTALL) -m755 -d $(DESTDIR)$(incdir)
$(INSTALL) -m644 $(headers) $(DESTDIR)$(incdir)
+$(INSTALLDIRS):
+ @echo "Making install in $(patsubst install-%,%,$@)"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
+
+
-include .*.d
diff --git a/man/Makefile b/man/Makefile
index 1ba23b5..54b57d1 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -21,7 +21,6 @@ all: $(MANPAGES)
$(Q)$(GZIPCMD) -n -c $< > $@
clean :
- @echo "Cleaning manpages"
$(Q)rm -f $(MANPAGES)
install: $(MANPAGES)
--
1.7.1
next prev parent reply other threads:[~2013-06-11 23:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
2013-06-11 23:15 ` Eric Sandeen [this message]
2013-09-02 14:26 ` [PATCH 1/3] Btrfs-progs: Add Makefile infrastructure for subdirs David Sterba
2013-06-11 23:15 ` [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir Eric Sandeen
2013-09-02 14:43 ` David Sterba
2013-09-03 20:53 ` Eric Sandeen
2013-06-11 23:15 ` [PATCH 3/3] Btrfs-progs: move btrfs cmd files to cmd/ subdir Eric Sandeen
2013-06-12 0:28 ` Eric Sandeen
2013-06-12 0:38 ` [PATCH 3/3 V2] " Eric Sandeen
2013-09-02 14:45 ` David Sterba
2013-09-03 20:55 ` Eric Sandeen
2013-06-11 23:24 ` [PATCH 0/3] Btrfs-progs: make some subdirs Zach Brown
2013-06-12 0:01 ` Chris Mason
2013-06-12 0:40 ` [PATCH 4/3] Btrfs-progs: fix up .gitignore Eric Sandeen
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=1370992519-21369-2-git-send-email-sandeen@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
/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).