* [PATCH 1/3] Btrfs-progs: Add Makefile infrastructure for subdirs
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
@ 2013-06-11 23:15 ` Eric Sandeen
2013-09-02 14:26 ` David Sterba
2013-06-11 23:15 ` [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir Eric Sandeen
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2013-06-11 23:15 UTC (permalink / raw)
To: linux-btrfs
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
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
2013-06-11 23:15 ` [PATCH 1/3] Btrfs-progs: Add Makefile infrastructure for subdirs Eric Sandeen
@ 2013-06-11 23:15 ` Eric Sandeen
2013-09-02 14:43 ` David Sterba
2013-06-11 23:15 ` [PATCH 3/3] Btrfs-progs: move btrfs cmd files to cmd/ subdir Eric Sandeen
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2013-06-11 23:15 UTC (permalink / raw)
To: linux-btrfs
Move test tools to tests/
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Makefile | 23 +--------
tests/Makefile | 49 ++++++++++++++++++++
.../btrfs-corrupt-block.c | 0
dir-test.c => tests/dir-test.c | 0
ioctl-test.c => tests/ioctl-test.c | 0
quick-test.c => tests/quick-test.c | 0
random-test.c => tests/random-test.c | 0
send-test.c => tests/send-test.c | 0
8 files changed, 52 insertions(+), 20 deletions(-)
create mode 100644 tests/Makefile
rename btrfs-corrupt-block.c => tests/btrfs-corrupt-block.c (100%)
rename dir-test.c => tests/dir-test.c (100%)
rename ioctl-test.c => tests/ioctl-test.c (100%)
rename quick-test.c => tests/quick-test.c (100%)
rename random-test.c => tests/random-test.c (100%)
rename send-test.c => tests/send-test.c (100%)
diff --git a/Makefile b/Makefile
index 5411ad9..01b71ec 100644
--- a/Makefile
+++ b/Makefile
@@ -56,7 +56,7 @@ btrfs_convert_libs = -lext2fs -lcom_err
btrfs_image_libs = -lpthread
btrfs_fragment_libs = -lgd -lpng -ljpeg -lfreetype
-SUBDIRS = man
+SUBDIRS = man tests
BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
@@ -102,7 +102,7 @@ endif
all: version.h $(progs) $(BUILDDIRS)
$(SUBDIRS): $(BUILDDIRS)
-$(BUILDDIRS):
+$(BUILDDIRS): $(libs)
@echo "Making all in $(patsubst build-%,%,$@)"
$(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst build-%,%,$@)
@@ -178,30 +178,13 @@ btrfstune: $(objects) $(libs) btrfstune.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
-dir-test: $(objects) $(libs) dir-test.o
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
-
-quick-test: $(objects) $(libs) quick-test.o
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS)
-
-ioctl-test: $(objects) $(libs) ioctl-test.o
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o ioctl-test $(objects) ioctl-test.o $(LDFLAGS) $(LIBS)
-
-send-test: $(objects) $(libs) send-test.o
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o send-test $(objects) send-test.o $(LDFLAGS) $(LIBS) -lpthread
-
manpages:
$(Q)$(MAKE) $(MAKEOPTS) -C man
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 \
+ btrfs-zero-log btrfstune btrfsck btrfs.static mkfs.btrfs.static btrfs-calc-size \
version.h \
$(libs) $(lib_links)
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..198de0d
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,49 @@
+CFLAGS += -I..
+
+objects := $(addprefix ../, $(objects))
+
+lib_LIBS = -lblkid -luuid
+LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
+
+# These last 2 don't actually build anymore
+progs = btrfs-corrupt-block ioctl-test quick-test send-test # random-test dir-test
+
+libs_static = libbtrfs.a
+libs = $(addprefix ../, $(libs_static))
+headers = $(libbtrfs_headers)
+
+.c.o:
+ $(Q)$(check) $<
+ @echo " [CC] $@"
+ $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
+
+all: $(progs)
+
+btrfs-corrupt-block: $(objects) $(libs) btrfs-corrupt-block.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o btrfs-corrupt-block $(objects) btrfs-corrupt-block.o $(LDFLAGS) $(LIBS)
+
+dir-test: $(objects) $(libs) dir-test.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o dir-test $(objects) dir-test.o $(LDFLAGS) $(LIBS)
+
+ioctl-test: $(objects) $(libs) ioctl-test.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o ioctl-test $(objects) ioctl-test.o $(LDFLAGS) $(LIBS)
+
+quick-test: $(objects) $(libs) quick-test.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o quick-test $(objects) quick-test.o $(LDFLAGS) $(LIBS)
+
+random-test: $(objects) $(libs) random-test.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o random-test $(objects) random-test.o $(LDFLAGS) $(LIBS)
+
+send-test: $(objects) $(libs) send-test.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o send-test $(objects) send-test.o $(LDFLAGS) $(LIBS) -lpthread
+
+clean :
+ $(Q)rm -f *.o .*.d $(progs)
+
+-include .*.d
diff --git a/btrfs-corrupt-block.c b/tests/btrfs-corrupt-block.c
similarity index 100%
rename from btrfs-corrupt-block.c
rename to tests/btrfs-corrupt-block.c
diff --git a/dir-test.c b/tests/dir-test.c
similarity index 100%
rename from dir-test.c
rename to tests/dir-test.c
diff --git a/ioctl-test.c b/tests/ioctl-test.c
similarity index 100%
rename from ioctl-test.c
rename to tests/ioctl-test.c
diff --git a/quick-test.c b/tests/quick-test.c
similarity index 100%
rename from quick-test.c
rename to tests/quick-test.c
diff --git a/random-test.c b/tests/random-test.c
similarity index 100%
rename from random-test.c
rename to tests/random-test.c
diff --git a/send-test.c b/tests/send-test.c
similarity index 100%
rename from send-test.c
rename to tests/send-test.c
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir
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
0 siblings, 1 reply; 14+ messages in thread
From: David Sterba @ 2013-09-02 14:43 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-btrfs, Kusanagi Kouichi
On Tue, Jun 11, 2013 at 06:15:18PM -0500, Eric Sandeen wrote:
> Move test tools to tests/
> rename btrfs-corrupt-block.c => tests/btrfs-corrupt-block.c (100%)
IMO this is not a test by itself, so it should stay in the toplevel dir.
> --- /dev/null
> +++ b/tests/Makefile
> @@ -0,0 +1,49 @@
eg.
TOPLEVEL = ..
> +CFLAGS += -I..
CFLAGS += -I$(TOPLEVEL)
> +
> +objects := $(addprefix ../, $(objects))
etc. s/../$(TOPLEVEL)
> +
> +lib_LIBS = -lblkid -luuid
> +LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
> +
> +# These last 2 don't actually build anymore
> +progs = btrfs-corrupt-block ioctl-test quick-test send-test # random-test dir-test
> +
> +libs_static = libbtrfs.a
> +libs = $(addprefix ../, $(libs_static))
> +headers = $(libbtrfs_headers)
> +
the default rule belongs here, ie
all: $(progs)
Otherwise 'make' in the tests/ subdir will try to execute the first .c
file it needs to build.
> +.c.o:
> + $(Q)$(check) $<
> + @echo " [CC] $@"
> + $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
Until now we've had only man/ and it does not compile anything, now
tests/ duplicate the .c.o: rule. The rules are not exported to subdirs,
we need either to duplicate it in every subdir/Makefile or have
something like Makefile.rules or builddefs, and each Makefile has to
keep track back to the toplevel dir. We want to be able to 'make tests'
but also just 'make' in the tests/ directory -- which does not work
right now.
> +
> +all: $(progs)
> +
> +clean :
> + $(Q)rm -f *.o .*.d $(progs)
> +
> +-include .*.d
This should probably look like the update in the toplevel makefile:
ifneq ($(MAKECMDGOALS),clean)
-include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
endif
and for the clean: rule a minor update: the .d files do not start with '.'.
(Both introduced in "btrfs-progs: Fix automatic prerequisite generation")
Let's start with moving just the tests, see how the makefiles work and
then proceed with cmds/ and the shared kernel files.
david
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir
2013-09-02 14:43 ` David Sterba
@ 2013-09-03 20:53 ` Eric Sandeen
0 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-09-03 20:53 UTC (permalink / raw)
To: dsterba, linux-btrfs, Kusanagi Kouichi
On 9/2/13 9:43 AM, David Sterba wrote:
> On Tue, Jun 11, 2013 at 06:15:18PM -0500, Eric Sandeen wrote:
>> Move test tools to tests/
>
>> rename btrfs-corrupt-block.c => tests/btrfs-corrupt-block.c (100%)
>
> IMO this is not a test by itself, so it should stay in the toplevel dir.
Hum, well, it has a main() - ok, not a test, but a tool used for testing?
Ok, fine. Maybe misc/ someday ;)
>
>> --- /dev/null
>> +++ b/tests/Makefile
>> @@ -0,0 +1,49 @@
> eg.
> TOPLEVEL = ..
>
>> +CFLAGS += -I..
> CFLAGS += -I$(TOPLEVEL)
>
>> +
>> +objects := $(addprefix ../, $(objects))
>
> etc. s/../$(TOPLEVEL)
Ok, that's probably good.
>> +
>> +lib_LIBS = -lblkid -luuid
>> +LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
>> +
>> +# These last 2 don't actually build anymore
>> +progs = btrfs-corrupt-block ioctl-test quick-test send-test # random-test dir-test
>> +
>> +libs_static = libbtrfs.a
>> +libs = $(addprefix ../, $(libs_static))
>> +headers = $(libbtrfs_headers)
>> +
>
> the default rule belongs here, ie
> all: $(progs)
>
> Otherwise 'make' in the tests/ subdir will try to execute the first .c
> file it needs to build.
>
>> +.c.o:
>> + $(Q)$(check) $<
>> + @echo " [CC] $@"
>> + $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
>
> Until now we've had only man/ and it does not compile anything, now
> tests/ duplicate the .c.o: rule. The rules are not exported to subdirs,
> we need either to duplicate it in every subdir/Makefile or have
> something like Makefile.rules or builddefs, and each Makefile has to
> keep track back to the toplevel dir. We want to be able to 'make tests'
> but also just 'make' in the tests/ directory -- which does not work
> right now.
*nod* ok. It's been a while since I did make hacking, sorry.
>> +
>> +all: $(progs)
>> +
>
>> +clean :
>> + $(Q)rm -f *.o .*.d $(progs)
>> +
>> +-include .*.d
>
> This should probably look like the update in the toplevel makefile:
>
> ifneq ($(MAKECMDGOALS),clean)
> -include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
> endif
>
> and for the clean: rule a minor update: the .d files do not start with '.'.
> (Both introduced in "btrfs-progs: Fix automatic prerequisite generation")
>
> Let's start with moving just the tests, see how the makefiles work and
> then proceed with cmds/ and the shared kernel files.
Sounds like a plan.
thanks for the review,
-Eric
>
> david
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3] Btrfs-progs: move btrfs cmd files to cmd/ subdir
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
2013-06-11 23:15 ` [PATCH 1/3] Btrfs-progs: Add Makefile infrastructure for subdirs Eric Sandeen
2013-06-11 23:15 ` [PATCH 2/3] Btrfs-progs: move test tools to tests/ subdir Eric Sandeen
@ 2013-06-11 23:15 ` Eric Sandeen
2013-06-12 0:28 ` Eric Sandeen
2013-06-12 0:38 ` [PATCH 3/3 V2] " Eric Sandeen
2013-06-11 23:24 ` [PATCH 0/3] Btrfs-progs: make some subdirs Zach Brown
2013-06-12 0:40 ` [PATCH 4/3] Btrfs-progs: fix up .gitignore Eric Sandeen
4 siblings, 2 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-06-11 23:15 UTC (permalink / raw)
To: linux-btrfs
Move btrfs cmd files to cmd/ subdir
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Makefile | 38 ++++++-----------
cmd/Makefile | 61 ++++++++++++++++++++++++++++
btrfs.c => cmd/btrfs.c | 0
cmds-balance.c => cmd/cmds-balance.c | 0
cmds-check.c => cmd/cmds-check.c | 0
cmds-device.c => cmd/cmds-device.c | 0
cmds-filesystem.c => cmd/cmds-filesystem.c | 0
cmds-inspect.c => cmd/cmds-inspect.c | 0
cmds-qgroup.c => cmd/cmds-qgroup.c | 0
cmds-quota.c => cmd/cmds-quota.c | 0
cmds-receive.c => cmd/cmds-receive.c | 0
cmds-replace.c => cmd/cmds-replace.c | 0
cmds-restore.c => cmd/cmds-restore.c | 0
cmds-scrub.c => cmd/cmds-scrub.c | 0
cmds-send.c => cmd/cmds-send.c | 0
cmds-subvolume.c => cmd/cmds-subvolume.c | 0
help.c => cmd/help.c | 0
17 files changed, 74 insertions(+), 25 deletions(-)
create mode 100644 cmd/Makefile
rename btrfs.c => cmd/btrfs.c (100%)
rename cmds-balance.c => cmd/cmds-balance.c (100%)
rename cmds-check.c => cmd/cmds-check.c (100%)
rename cmds-device.c => cmd/cmds-device.c (100%)
rename cmds-filesystem.c => cmd/cmds-filesystem.c (100%)
rename cmds-inspect.c => cmd/cmds-inspect.c (100%)
rename cmds-qgroup.c => cmd/cmds-qgroup.c (100%)
rename cmds-quota.c => cmd/cmds-quota.c (100%)
rename cmds-receive.c => cmd/cmds-receive.c (100%)
rename cmds-replace.c => cmd/cmds-replace.c (100%)
rename cmds-restore.c => cmd/cmds-restore.c (100%)
rename cmds-scrub.c => cmd/cmds-scrub.c (100%)
rename cmds-send.c => cmd/cmds-send.c (100%)
rename cmds-subvolume.c => cmd/cmds-subvolume.c (100%)
rename help.c => cmd/help.c (100%)
diff --git a/Makefile b/Makefile
index 01b71ec..3bc105e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,10 +10,6 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
extent-cache.o extent_io.o volumes.o utils.o repair.o \
qgroup.o raid6.o free-space-cache.o
-cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
- cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
- cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
- cmds-restore.o
libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o
libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
@@ -46,8 +42,8 @@ endif
MAKEOPTS = --no-print-directory Q=$(Q)
-progs = mkfs.btrfs btrfs-debug-tree btrfsck \
- btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
+progs = mkfs.btrfs btrfs-debug-tree \
+ btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
btrfs-find-root btrfstune btrfs-show-super
# external libs required by various binaries; for btrfs-foo,
@@ -56,13 +52,17 @@ btrfs_convert_libs = -lext2fs -lcom_err
btrfs_image_libs = -lpthread
btrfs_fragment_libs = -lgd -lpng -ljpeg -lfreetype
-SUBDIRS = man tests
+SUBDIRS = cmd man tests
+STATIC_SUBDIRS = cmd
BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
+STATIC_BUILDDIRS = $(patsubst %,buildstatic-%,$(STATIC_SUBDIRS))
INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
.PHONY: $(SUBDIRS)
+.PHONY: $(STATIC_SUBDIRS)
.PHONY: $(BUILDDIRS)
+.PHONY: $(STATIC_BUILDDIRS)
.PHONY: $(INSTALLDIRS)
.PHONY: $(TESTDIRS)
.PHONY: $(CLEANDIRS)
@@ -70,7 +70,6 @@ CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
# Create all the static targets
static_objects = $(patsubst %.o, %.static.o, $(objects))
-static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects))
# Define static compilation flags
@@ -110,7 +109,11 @@ $(BUILDDIRS): $(libs)
# NOTE: For static compiles, you need to have all the required libs
# static equivalent available
#
-static: version.h btrfs.static mkfs.btrfs.static btrfs-find-root.static
+static: version.h mkfs.btrfs.static btrfs-find-root.static $(STATIC_BUILDDIRS)
+$(STATIC_SUBDIRS): $(STATIC_BUILDDIRS)
+$(STATIC_BUILDDIRS): $(static_objects) $(static_libbtrfs_objects)
+ @echo "Making static in $(patsubst buildstatic-%,%,$@)"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst buildstatic-%,%,$@) static
version.h:
@echo " [SH] $@"
@@ -150,21 +153,6 @@ btrfs-%: version.h $(objects) $(libs) btrfs-%.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))
-btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
- $(objects) $(LDFLAGS) $(LIBS) -lpthread
-
-btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
- @echo " [LD] $@"
- $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
- $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
-
-# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
-btrfsck: btrfs
- @echo " [LN] $@"
- $(Q)$(LN) -f btrfs btrfsck
-
mkfs.btrfs: $(objects) $(libs) mkfs.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
@@ -184,7 +172,7 @@ manpages:
clean: $(CLEANDIRS)
@echo "Cleaning"
$(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
- btrfs-zero-log btrfstune btrfsck btrfs.static mkfs.btrfs.static btrfs-calc-size \
+ btrfs-zero-log btrfstune mkfs.btrfs.static btrfs-calc-size \
version.h \
$(libs) $(lib_links)
diff --git a/cmd/Makefile b/cmd/Makefile
new file mode 100644
index 0000000..3b1b3c5
--- /dev/null
+++ b/cmd/Makefile
@@ -0,0 +1,61 @@
+CFLAGS += -I..
+
+cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
+ cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
+ cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
+ cmds-restore.o
+objects := $(addprefix ../, $(objects))
+static_objects = $(patsubst %.o, %.static.o, $(objects))
+
+progs = btrfs
+
+lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
+LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
+
+libs_static = libbtrfs.a
+libs = $(addprefix ../, $(libs_static))
+
+.c.o:
+ $(Q)$(check) $<
+ @echo " [CC] $@"
+ $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
+
+%.static.o: %.c
+ @echo " [CC] $@"
+ $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
+
+all: $(progs)
+
+#
+# NOTE: For static compiles, you need to have all the required libs
+# static equivalent available
+#
+static: btrfs.static
+
+btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
+ $(objects) $(LDFLAGS) $(LIBS) -lpthread
+
+btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
+ @echo " [LD] $@"
+ $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
+ $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
+
+# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
+btrfsck: btrfs
+ @echo " [LN] $@"
+ $(Q)$(LN) -f btrfs btrfsck
+
+clean:
+ $(Q)rm -f *.o .*.d $(progs)
+
+install: $(libs) $(progs) $(INSTALLDIRS)
+ $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
+ $(INSTALL) $(progs) $(DESTDIR)$(bindir)
+
+$(INSTALLDIRS):
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(@:install-%=%) install
+
+
+-include .*.d
diff --git a/btrfs.c b/cmd/btrfs.c
similarity index 100%
rename from btrfs.c
rename to cmd/btrfs.c
diff --git a/cmds-balance.c b/cmd/cmds-balance.c
similarity index 100%
rename from cmds-balance.c
rename to cmd/cmds-balance.c
diff --git a/cmds-check.c b/cmd/cmds-check.c
similarity index 100%
rename from cmds-check.c
rename to cmd/cmds-check.c
diff --git a/cmds-device.c b/cmd/cmds-device.c
similarity index 100%
rename from cmds-device.c
rename to cmd/cmds-device.c
diff --git a/cmds-filesystem.c b/cmd/cmds-filesystem.c
similarity index 100%
rename from cmds-filesystem.c
rename to cmd/cmds-filesystem.c
diff --git a/cmds-inspect.c b/cmd/cmds-inspect.c
similarity index 100%
rename from cmds-inspect.c
rename to cmd/cmds-inspect.c
diff --git a/cmds-qgroup.c b/cmd/cmds-qgroup.c
similarity index 100%
rename from cmds-qgroup.c
rename to cmd/cmds-qgroup.c
diff --git a/cmds-quota.c b/cmd/cmds-quota.c
similarity index 100%
rename from cmds-quota.c
rename to cmd/cmds-quota.c
diff --git a/cmds-receive.c b/cmd/cmds-receive.c
similarity index 100%
rename from cmds-receive.c
rename to cmd/cmds-receive.c
diff --git a/cmds-replace.c b/cmd/cmds-replace.c
similarity index 100%
rename from cmds-replace.c
rename to cmd/cmds-replace.c
diff --git a/cmds-restore.c b/cmd/cmds-restore.c
similarity index 100%
rename from cmds-restore.c
rename to cmd/cmds-restore.c
diff --git a/cmds-scrub.c b/cmd/cmds-scrub.c
similarity index 100%
rename from cmds-scrub.c
rename to cmd/cmds-scrub.c
diff --git a/cmds-send.c b/cmd/cmds-send.c
similarity index 100%
rename from cmds-send.c
rename to cmd/cmds-send.c
diff --git a/cmds-subvolume.c b/cmd/cmds-subvolume.c
similarity index 100%
rename from cmds-subvolume.c
rename to cmd/cmds-subvolume.c
diff --git a/help.c b/cmd/help.c
similarity index 100%
rename from help.c
rename to cmd/help.c
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] Btrfs-progs: move btrfs cmd files to cmd/ subdir
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
1 sibling, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-06-12 0:28 UTC (permalink / raw)
To: linux-btrfs
On 6/11/13 6:15 PM, Eric Sandeen wrote:
> Move btrfs cmd files to cmd/ subdir
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
crud just realized this doesn't DTRT w/ btrfsck links, will have
to send a V2 for this one I guess.
-Eric
> ---
> Makefile | 38 ++++++-----------
> cmd/Makefile | 61 ++++++++++++++++++++++++++++
> btrfs.c => cmd/btrfs.c | 0
> cmds-balance.c => cmd/cmds-balance.c | 0
> cmds-check.c => cmd/cmds-check.c | 0
> cmds-device.c => cmd/cmds-device.c | 0
> cmds-filesystem.c => cmd/cmds-filesystem.c | 0
> cmds-inspect.c => cmd/cmds-inspect.c | 0
> cmds-qgroup.c => cmd/cmds-qgroup.c | 0
> cmds-quota.c => cmd/cmds-quota.c | 0
> cmds-receive.c => cmd/cmds-receive.c | 0
> cmds-replace.c => cmd/cmds-replace.c | 0
> cmds-restore.c => cmd/cmds-restore.c | 0
> cmds-scrub.c => cmd/cmds-scrub.c | 0
> cmds-send.c => cmd/cmds-send.c | 0
> cmds-subvolume.c => cmd/cmds-subvolume.c | 0
> help.c => cmd/help.c | 0
> 17 files changed, 74 insertions(+), 25 deletions(-)
> create mode 100644 cmd/Makefile
> rename btrfs.c => cmd/btrfs.c (100%)
> rename cmds-balance.c => cmd/cmds-balance.c (100%)
> rename cmds-check.c => cmd/cmds-check.c (100%)
> rename cmds-device.c => cmd/cmds-device.c (100%)
> rename cmds-filesystem.c => cmd/cmds-filesystem.c (100%)
> rename cmds-inspect.c => cmd/cmds-inspect.c (100%)
> rename cmds-qgroup.c => cmd/cmds-qgroup.c (100%)
> rename cmds-quota.c => cmd/cmds-quota.c (100%)
> rename cmds-receive.c => cmd/cmds-receive.c (100%)
> rename cmds-replace.c => cmd/cmds-replace.c (100%)
> rename cmds-restore.c => cmd/cmds-restore.c (100%)
> rename cmds-scrub.c => cmd/cmds-scrub.c (100%)
> rename cmds-send.c => cmd/cmds-send.c (100%)
> rename cmds-subvolume.c => cmd/cmds-subvolume.c (100%)
> rename help.c => cmd/help.c (100%)
>
> diff --git a/Makefile b/Makefile
> index 01b71ec..3bc105e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -10,10 +10,6 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
> root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
> extent-cache.o extent_io.o volumes.o utils.o repair.o \
> qgroup.o raid6.o free-space-cache.o
> -cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
> - cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
> - cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
> - cmds-restore.o
> libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o
> libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
> crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
> @@ -46,8 +42,8 @@ endif
>
> MAKEOPTS = --no-print-directory Q=$(Q)
>
> -progs = mkfs.btrfs btrfs-debug-tree btrfsck \
> - btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
> +progs = mkfs.btrfs btrfs-debug-tree \
> + btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
> btrfs-find-root btrfstune btrfs-show-super
>
> # external libs required by various binaries; for btrfs-foo,
> @@ -56,13 +52,17 @@ btrfs_convert_libs = -lext2fs -lcom_err
> btrfs_image_libs = -lpthread
> btrfs_fragment_libs = -lgd -lpng -ljpeg -lfreetype
>
> -SUBDIRS = man tests
> +SUBDIRS = cmd man tests
> +STATIC_SUBDIRS = cmd
> BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
> +STATIC_BUILDDIRS = $(patsubst %,buildstatic-%,$(STATIC_SUBDIRS))
> INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
> CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
>
> .PHONY: $(SUBDIRS)
> +.PHONY: $(STATIC_SUBDIRS)
> .PHONY: $(BUILDDIRS)
> +.PHONY: $(STATIC_BUILDDIRS)
> .PHONY: $(INSTALLDIRS)
> .PHONY: $(TESTDIRS)
> .PHONY: $(CLEANDIRS)
> @@ -70,7 +70,6 @@ CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
>
> # Create all the static targets
> static_objects = $(patsubst %.o, %.static.o, $(objects))
> -static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
> static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects))
>
> # Define static compilation flags
> @@ -110,7 +109,11 @@ $(BUILDDIRS): $(libs)
> # NOTE: For static compiles, you need to have all the required libs
> # static equivalent available
> #
> -static: version.h btrfs.static mkfs.btrfs.static btrfs-find-root.static
> +static: version.h mkfs.btrfs.static btrfs-find-root.static $(STATIC_BUILDDIRS)
> +$(STATIC_SUBDIRS): $(STATIC_BUILDDIRS)
> +$(STATIC_BUILDDIRS): $(static_objects) $(static_libbtrfs_objects)
> + @echo "Making static in $(patsubst buildstatic-%,%,$@)"
> + $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst buildstatic-%,%,$@) static
>
> version.h:
> @echo " [SH] $@"
> @@ -150,21 +153,6 @@ btrfs-%: version.h $(objects) $(libs) btrfs-%.o
> @echo " [LD] $@"
> $(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))
>
> -btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
> - @echo " [LD] $@"
> - $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
> - $(objects) $(LDFLAGS) $(LIBS) -lpthread
> -
> -btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
> - @echo " [LD] $@"
> - $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
> - $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
> -
> -# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
> -btrfsck: btrfs
> - @echo " [LN] $@"
> - $(Q)$(LN) -f btrfs btrfsck
> -
> mkfs.btrfs: $(objects) $(libs) mkfs.o
> @echo " [LD] $@"
> $(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
> @@ -184,7 +172,7 @@ manpages:
> clean: $(CLEANDIRS)
> @echo "Cleaning"
> $(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
> - btrfs-zero-log btrfstune btrfsck btrfs.static mkfs.btrfs.static btrfs-calc-size \
> + btrfs-zero-log btrfstune mkfs.btrfs.static btrfs-calc-size \
> version.h \
> $(libs) $(lib_links)
>
> diff --git a/cmd/Makefile b/cmd/Makefile
> new file mode 100644
> index 0000000..3b1b3c5
> --- /dev/null
> +++ b/cmd/Makefile
> @@ -0,0 +1,61 @@
> +CFLAGS += -I..
> +
> +cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
> + cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
> + cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
> + cmds-restore.o
> +objects := $(addprefix ../, $(objects))
> +static_objects = $(patsubst %.o, %.static.o, $(objects))
> +
> +progs = btrfs
> +
> +lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
> +LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
> +
> +libs_static = libbtrfs.a
> +libs = $(addprefix ../, $(libs_static))
> +
> +.c.o:
> + $(Q)$(check) $<
> + @echo " [CC] $@"
> + $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
> +
> +%.static.o: %.c
> + @echo " [CC] $@"
> + $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
> +
> +all: $(progs)
> +
> +#
> +# NOTE: For static compiles, you need to have all the required libs
> +# static equivalent available
> +#
> +static: btrfs.static
> +
> +btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
> + @echo " [LD] $@"
> + $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
> + $(objects) $(LDFLAGS) $(LIBS) -lpthread
> +
> +btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
> + @echo " [LD] $@"
> + $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
> + $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
> +
> +# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
> +btrfsck: btrfs
> + @echo " [LN] $@"
> + $(Q)$(LN) -f btrfs btrfsck
> +
> +clean:
> + $(Q)rm -f *.o .*.d $(progs)
> +
> +install: $(libs) $(progs) $(INSTALLDIRS)
> + $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
> + $(INSTALL) $(progs) $(DESTDIR)$(bindir)
> +
> +$(INSTALLDIRS):
> + $(Q)$(MAKE) $(MAKEOPTS) -C $(@:install-%=%) install
> +
> +
> +-include .*.d
> diff --git a/btrfs.c b/cmd/btrfs.c
> similarity index 100%
> rename from btrfs.c
> rename to cmd/btrfs.c
> diff --git a/cmds-balance.c b/cmd/cmds-balance.c
> similarity index 100%
> rename from cmds-balance.c
> rename to cmd/cmds-balance.c
> diff --git a/cmds-check.c b/cmd/cmds-check.c
> similarity index 100%
> rename from cmds-check.c
> rename to cmd/cmds-check.c
> diff --git a/cmds-device.c b/cmd/cmds-device.c
> similarity index 100%
> rename from cmds-device.c
> rename to cmd/cmds-device.c
> diff --git a/cmds-filesystem.c b/cmd/cmds-filesystem.c
> similarity index 100%
> rename from cmds-filesystem.c
> rename to cmd/cmds-filesystem.c
> diff --git a/cmds-inspect.c b/cmd/cmds-inspect.c
> similarity index 100%
> rename from cmds-inspect.c
> rename to cmd/cmds-inspect.c
> diff --git a/cmds-qgroup.c b/cmd/cmds-qgroup.c
> similarity index 100%
> rename from cmds-qgroup.c
> rename to cmd/cmds-qgroup.c
> diff --git a/cmds-quota.c b/cmd/cmds-quota.c
> similarity index 100%
> rename from cmds-quota.c
> rename to cmd/cmds-quota.c
> diff --git a/cmds-receive.c b/cmd/cmds-receive.c
> similarity index 100%
> rename from cmds-receive.c
> rename to cmd/cmds-receive.c
> diff --git a/cmds-replace.c b/cmd/cmds-replace.c
> similarity index 100%
> rename from cmds-replace.c
> rename to cmd/cmds-replace.c
> diff --git a/cmds-restore.c b/cmd/cmds-restore.c
> similarity index 100%
> rename from cmds-restore.c
> rename to cmd/cmds-restore.c
> diff --git a/cmds-scrub.c b/cmd/cmds-scrub.c
> similarity index 100%
> rename from cmds-scrub.c
> rename to cmd/cmds-scrub.c
> diff --git a/cmds-send.c b/cmd/cmds-send.c
> similarity index 100%
> rename from cmds-send.c
> rename to cmd/cmds-send.c
> diff --git a/cmds-subvolume.c b/cmd/cmds-subvolume.c
> similarity index 100%
> rename from cmds-subvolume.c
> rename to cmd/cmds-subvolume.c
> diff --git a/help.c b/cmd/help.c
> similarity index 100%
> rename from help.c
> rename to cmd/help.c
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3 V2] Btrfs-progs: move btrfs cmd files to cmd/ subdir
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 ` Eric Sandeen
2013-09-02 14:45 ` David Sterba
1 sibling, 1 reply; 14+ messages in thread
From: Eric Sandeen @ 2013-06-12 0:38 UTC (permalink / raw)
To: linux-btrfs
Move btrfs cmd files to cmd/ subdir
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
V2: move btrfsck symlink handling to cmd/Makefile too
Makefile | 38 ++++++-----------
cmd/Makefile | 61 ++++++++++++++++++++++++++++
btrfs.c => cmd/btrfs.c | 0
cmds-balance.c => cmd/cmds-balance.c | 0
cmds-check.c => cmd/cmds-check.c | 0
cmds-device.c => cmd/cmds-device.c | 0
cmds-filesystem.c => cmd/cmds-filesystem.c | 0
cmds-inspect.c => cmd/cmds-inspect.c | 0
cmds-qgroup.c => cmd/cmds-qgroup.c | 0
cmds-quota.c => cmd/cmds-quota.c | 0
cmds-receive.c => cmd/cmds-receive.c | 0
cmds-replace.c => cmd/cmds-replace.c | 0
cmds-restore.c => cmd/cmds-restore.c | 0
cmds-scrub.c => cmd/cmds-scrub.c | 0
cmds-send.c => cmd/cmds-send.c | 0
cmds-subvolume.c => cmd/cmds-subvolume.c | 0
help.c => cmd/help.c | 0
17 files changed, 74 insertions(+), 25 deletions(-)
create mode 100644 cmd/Makefile
rename btrfs.c => cmd/btrfs.c (100%)
rename cmds-balance.c => cmd/cmds-balance.c (100%)
rename cmds-check.c => cmd/cmds-check.c (100%)
rename cmds-device.c => cmd/cmds-device.c (100%)
rename cmds-filesystem.c => cmd/cmds-filesystem.c (100%)
rename cmds-inspect.c => cmd/cmds-inspect.c (100%)
rename cmds-qgroup.c => cmd/cmds-qgroup.c (100%)
rename cmds-quota.c => cmd/cmds-quota.c (100%)
rename cmds-receive.c => cmd/cmds-receive.c (100%)
rename cmds-replace.c => cmd/cmds-replace.c (100%)
rename cmds-restore.c => cmd/cmds-restore.c (100%)
rename cmds-scrub.c => cmd/cmds-scrub.c (100%)
rename cmds-send.c => cmd/cmds-send.c (100%)
rename cmds-subvolume.c => cmd/cmds-subvolume.c (100%)
rename help.c => cmd/help.c (100%)
diff --git a/Makefile b/Makefile
index 01b71ec..db8f348 100644
--- a/Makefile
+++ b/Makefile
@@ -10,10 +10,6 @@ objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
extent-cache.o extent_io.o volumes.o utils.o repair.o \
qgroup.o raid6.o free-space-cache.o
-cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
- cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
- cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
- cmds-restore.o
libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o
libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
@@ -46,8 +42,8 @@ endif
MAKEOPTS = --no-print-directory Q=$(Q)
-progs = mkfs.btrfs btrfs-debug-tree btrfsck \
- btrfs btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
+progs = mkfs.btrfs btrfs-debug-tree \
+ btrfs-map-logical btrfs-image btrfs-zero-log btrfs-convert \
btrfs-find-root btrfstune btrfs-show-super
# external libs required by various binaries; for btrfs-foo,
@@ -56,13 +52,17 @@ btrfs_convert_libs = -lext2fs -lcom_err
btrfs_image_libs = -lpthread
btrfs_fragment_libs = -lgd -lpng -ljpeg -lfreetype
-SUBDIRS = man tests
+SUBDIRS = cmd man tests
+STATIC_SUBDIRS = cmd
BUILDDIRS = $(patsubst %,build-%,$(SUBDIRS))
+STATIC_BUILDDIRS = $(patsubst %,buildstatic-%,$(STATIC_SUBDIRS))
INSTALLDIRS = $(patsubst %,install-%,$(SUBDIRS))
CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
.PHONY: $(SUBDIRS)
+.PHONY: $(STATIC_SUBDIRS)
.PHONY: $(BUILDDIRS)
+.PHONY: $(STATIC_BUILDDIRS)
.PHONY: $(INSTALLDIRS)
.PHONY: $(TESTDIRS)
.PHONY: $(CLEANDIRS)
@@ -70,7 +70,6 @@ CLEANDIRS = $(patsubst %,clean-%,$(SUBDIRS))
# Create all the static targets
static_objects = $(patsubst %.o, %.static.o, $(objects))
-static_cmds_objects = $(patsubst %.o, %.static.o, $(cmds_objects))
static_libbtrfs_objects = $(patsubst %.o, %.static.o, $(libbtrfs_objects))
# Define static compilation flags
@@ -110,7 +109,11 @@ $(BUILDDIRS): $(libs)
# NOTE: For static compiles, you need to have all the required libs
# static equivalent available
#
-static: version.h btrfs.static mkfs.btrfs.static btrfs-find-root.static
+static: version.h mkfs.btrfs.static btrfs-find-root.static $(STATIC_BUILDDIRS)
+$(STATIC_SUBDIRS): $(STATIC_BUILDDIRS)
+$(STATIC_BUILDDIRS): $(static_objects) $(static_libbtrfs_objects)
+ @echo "Making static in $(patsubst buildstatic-%,%,$@)"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst buildstatic-%,%,$@) static
version.h:
@echo " [SH] $@"
@@ -150,21 +153,6 @@ btrfs-%: version.h $(objects) $(libs) btrfs-%.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o $@ $(objects) $@.o $(LDFLAGS) $(LIBS) $($(subst -,_,$@-libs))
-btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
- @echo " [LD] $@"
- $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
- $(objects) $(LDFLAGS) $(LIBS) -lpthread
-
-btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
- @echo " [LD] $@"
- $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
- $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
-
-# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
-btrfsck: btrfs
- @echo " [LN] $@"
- $(Q)$(LN) -f btrfs btrfsck
-
mkfs.btrfs: $(objects) $(libs) mkfs.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o mkfs.btrfs $(objects) mkfs.o $(LDFLAGS) $(LIBS)
@@ -184,7 +172,7 @@ manpages:
clean: $(CLEANDIRS)
@echo "Cleaning"
$(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
- btrfs-zero-log btrfstune btrfsck btrfs.static mkfs.btrfs.static btrfs-calc-size \
+ btrfs-zero-log btrfstune mkfs.btrfs.static btrfs-calc-size \
version.h \
$(libs) $(lib_links)
@@ -195,8 +183,6 @@ $(CLEANDIRS):
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
- $(LN) -f $(DESTDIR)$(bindir)/btrfs $(DESTDIR)$(bindir)/btrfsck
$(INSTALL) -m755 -d $(DESTDIR)$(libdir)
$(INSTALL) $(libs) $(DESTDIR)$(libdir)
cp -a $(lib_links) $(DESTDIR)$(libdir)
diff --git a/cmd/Makefile b/cmd/Makefile
new file mode 100644
index 0000000..994febb
--- /dev/null
+++ b/cmd/Makefile
@@ -0,0 +1,63 @@
+CFLAGS += -I..
+
+cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
+ cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
+ cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
+ cmds-restore.o
+objects := $(addprefix ../, $(objects))
+static_objects = $(patsubst %.o, %.static.o, $(objects))
+
+progs = btrfs btrfsck
+
+lib_LIBS = -luuid -lblkid -lm -lz -llzo2 -L.
+LIBS = $(lib_LIBS) $(addprefix ../, $(libs_static))
+
+libs_static = libbtrfs.a
+libs = $(addprefix ../, $(libs_static))
+
+.c.o:
+ $(Q)$(check) $<
+ @echo " [CC] $@"
+ $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c $<
+
+%.static.o: %.c
+ @echo " [CC] $@"
+ $(Q)$(CC) $(DEPFLAGS) $(AM_CFLAGS) $(STATIC_CFLAGS) -c $< -o $@
+
+all: $(progs)
+
+#
+# NOTE: For static compiles, you need to have all the required libs
+# static equivalent available
+#
+static: btrfs.static
+
+btrfs: $(objects) btrfs.o help.o $(cmds_objects) $(libs)
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o btrfs btrfs.o help.o $(cmds_objects) \
+ $(objects) $(LDFLAGS) $(LIBS) -lpthread
+
+btrfs.static: $(static_objects) btrfs.static.o help.static.o $(static_cmds_objects) $(static_libbtrfs_objects)
+ @echo " [LD] $@"
+ $(Q)$(CC) $(STATIC_CFLAGS) -o btrfs.static btrfs.static.o help.static.o $(static_cmds_objects) \
+ $(static_objects) $(static_libbtrfs_objects) $(STATIC_LDFLAGS) $(STATIC_LIBS)
+
+# For backward compatibility, 'btrfs' changes behaviour to fsck if it's named 'btrfsck'
+btrfsck: btrfs
+ @echo " [LN] $@"
+ $(Q)$(LN) -f btrfs btrfsck
+
+clean:
+ $(Q)rm -f *.o .*.d $(progs)
+
+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
+ $(LN) -f $(DESTDIR)$(bindir)/btrfs $(DESTDIR)$(bindir)/btrfsck
+
+$(INSTALLDIRS):
+ $(Q)$(MAKE) $(MAKEOPTS) -C $(@:install-%=%) install
+
+
+-include .*.d
diff --git a/btrfs.c b/cmd/btrfs.c
similarity index 100%
rename from btrfs.c
rename to cmd/btrfs.c
diff --git a/cmds-balance.c b/cmd/cmds-balance.c
similarity index 100%
rename from cmds-balance.c
rename to cmd/cmds-balance.c
diff --git a/cmds-check.c b/cmd/cmds-check.c
similarity index 100%
rename from cmds-check.c
rename to cmd/cmds-check.c
diff --git a/cmds-device.c b/cmd/cmds-device.c
similarity index 100%
rename from cmds-device.c
rename to cmd/cmds-device.c
diff --git a/cmds-filesystem.c b/cmd/cmds-filesystem.c
similarity index 100%
rename from cmds-filesystem.c
rename to cmd/cmds-filesystem.c
diff --git a/cmds-inspect.c b/cmd/cmds-inspect.c
similarity index 100%
rename from cmds-inspect.c
rename to cmd/cmds-inspect.c
diff --git a/cmds-qgroup.c b/cmd/cmds-qgroup.c
similarity index 100%
rename from cmds-qgroup.c
rename to cmd/cmds-qgroup.c
diff --git a/cmds-quota.c b/cmd/cmds-quota.c
similarity index 100%
rename from cmds-quota.c
rename to cmd/cmds-quota.c
diff --git a/cmds-receive.c b/cmd/cmds-receive.c
similarity index 100%
rename from cmds-receive.c
rename to cmd/cmds-receive.c
diff --git a/cmds-replace.c b/cmd/cmds-replace.c
similarity index 100%
rename from cmds-replace.c
rename to cmd/cmds-replace.c
diff --git a/cmds-restore.c b/cmd/cmds-restore.c
similarity index 100%
rename from cmds-restore.c
rename to cmd/cmds-restore.c
diff --git a/cmds-scrub.c b/cmd/cmds-scrub.c
similarity index 100%
rename from cmds-scrub.c
rename to cmd/cmds-scrub.c
diff --git a/cmds-send.c b/cmd/cmds-send.c
similarity index 100%
rename from cmds-send.c
rename to cmd/cmds-send.c
diff --git a/cmds-subvolume.c b/cmd/cmds-subvolume.c
similarity index 100%
rename from cmds-subvolume.c
rename to cmd/cmds-subvolume.c
diff --git a/help.c b/cmd/help.c
similarity index 100%
rename from help.c
rename to cmd/help.c
---
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3 V2] Btrfs-progs: move btrfs cmd files to cmd/ subdir
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
0 siblings, 1 reply; 14+ messages in thread
From: David Sterba @ 2013-09-02 14:45 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-btrfs
On Tue, Jun 11, 2013 at 07:38:03PM -0500, Eric Sandeen wrote:
> Move btrfs cmd files to cmd/ subdir
Are you ok with naming the subdirectory 'cmds'?
david
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3 V2] Btrfs-progs: move btrfs cmd files to cmd/ subdir
2013-09-02 14:45 ` David Sterba
@ 2013-09-03 20:55 ` Eric Sandeen
0 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-09-03 20:55 UTC (permalink / raw)
To: dsterba, linux-btrfs
On 9/2/13 9:45 AM, David Sterba wrote:
> On Tue, Jun 11, 2013 at 07:38:03PM -0500, Eric Sandeen wrote:
>> Move btrfs cmd files to cmd/ subdir
>
> Are you ok with naming the subdirectory 'cmds'?
>
> david
>
yep! That's the _last_ bike shed I want to paint. ;)
I had picked "cmd" because they are for the btrfs command (singular),
but *shrug* - it really doesn't matter to me.
-Eric
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/3] Btrfs-progs: make some subdirs
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
` (2 preceding siblings ...)
2013-06-11 23:15 ` [PATCH 3/3] Btrfs-progs: move btrfs cmd files to cmd/ subdir Eric Sandeen
@ 2013-06-11 23:24 ` Zach Brown
2013-06-12 0:01 ` Chris Mason
2013-06-12 0:40 ` [PATCH 4/3] Btrfs-progs: fix up .gitignore Eric Sandeen
4 siblings, 1 reply; 14+ messages in thread
From: Zach Brown @ 2013-06-11 23:24 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-btrfs
On Tue, Jun 11, 2013 at 06:15:16PM -0500, Eric Sandeen wrote:
> These are some patches I've been sitting on for a while that I think
> clean up the btrfs-progs tree a bit; there are still quite a few files
> left in the top-level dir, but moving tests & cmd files into cmd/
> seems to clean things up a bit. Curious to see what people think.
Seems reasonable to me.
> This is just file-moves and makefile-mangling, no code changes.
I guess .gitignore should also be updated.
> (a common/ or similar later on to hold kernel copies would probably
> be the next move if this all looks reasonable)
kernel_import_no_touching/ ? :)
- z
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 0/3] Btrfs-progs: make some subdirs
2013-06-11 23:24 ` [PATCH 0/3] Btrfs-progs: make some subdirs Zach Brown
@ 2013-06-12 0:01 ` Chris Mason
0 siblings, 0 replies; 14+ messages in thread
From: Chris Mason @ 2013-06-12 0:01 UTC (permalink / raw)
To: Zach Brown, Eric Sandeen; +Cc: linux-btrfs@vger.kernel.org
Quoting Zach Brown (2013-06-11 19:24:46)
> On Tue, Jun 11, 2013 at 06:15:16PM -0500, Eric Sandeen wrote:
> > These are some patches I've been sitting on for a while that I think
> > clean up the btrfs-progs tree a bit; there are still quite a few files
> > left in the top-level dir, but moving tests & cmd files into cmd/
> > seems to clean things up a bit. Curious to see what people think.
>
> Seems reasonable to me.
>
> > This is just file-moves and makefile-mangling, no code changes.
>
> I guess .gitignore should also be updated.
>
> > (a common/ or similar later on to hold kernel copies would probably
> > be the next move if this all looks reasonable)
>
> kernel_import_no_touching/ ? :)
dangerdonteverchange?
I'd actually just go for kernel_import. It would be nice if git had a
way to make the files readonly.
-chris
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/3] Btrfs-progs: fix up .gitignore
2013-06-11 23:15 [PATCH 0/3] Btrfs-progs: make some subdirs Eric Sandeen
` (3 preceding siblings ...)
2013-06-11 23:24 ` [PATCH 0/3] Btrfs-progs: make some subdirs Zach Brown
@ 2013-06-12 0:40 ` Eric Sandeen
4 siblings, 0 replies; 14+ messages in thread
From: Eric Sandeen @ 2013-06-12 0:40 UTC (permalink / raw)
To: linux-btrfs
Fix .gitignore for new file locations.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
(could update other patches rather than add 4th if it's better)
diff --git a/.gitignore b/.gitignore
index a7e1b19..abc7ca6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,17 +4,10 @@
version.h
version
man/*.gz
-btrfs
-btrfs.static
btrfs-debug-tree
btrfs-map-logical
btrfs-fragments
-btrfsck
calc-size
-ioctl-test
-dir-test
-send-test
-quick-test
find-root
mkfs.btrfs
mkfs.btrfs.static
@@ -26,10 +19,18 @@ btrfs-find-root.static
btrfs-image
btrfs-show-super
btrfs-zero-log
-btrfs-corrupt-block
btrfs-select-super
btrfstune
libbtrfs.a
libbtrfs.so
libbtrfs.so.0
libbtrfs.so.0.1
+cmd/btrfs
+cmd/btrfs.static
+cmd/btrfsck
+tests/btrfs-corrupt-block
+tests/dir-test
+tests/ioctl-test
+tests/quick-test
+tests/random-test
+tests/send-test
^ permalink raw reply related [flat|nested] 14+ messages in thread