[Ocfs2-tools-devel] [PATCH 24/24] tunefs rework: Link ocfs2ne into the build.
Joel Becker
joel.becker at oracle.com
Wed Aug 13 15:57:19 PDT 2008
ocfs2ne is now built alongside tunefs.ocfs2. They should do identical
things.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
Signed-off-by: Mark Fasheh <mfasheh at suse.com>
---
tunefs.ocfs2/.gitignore | 3 ++
tunefs.ocfs2/Makefile | 91 +++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 87 insertions(+), 7 deletions(-)
diff --git a/tunefs.ocfs2/.gitignore b/tunefs.ocfs2/.gitignore
index 5a1d5ed..9a57e18 100644
--- a/tunefs.ocfs2/.gitignore
+++ b/tunefs.ocfs2/.gitignore
@@ -4,3 +4,6 @@ tunefs.ocfs2
stamp-md5
*.d
tunefs.ocfs2.8
+o2ne_err.[ch]
+debug_*
+ocfs2ne
diff --git a/tunefs.ocfs2/Makefile b/tunefs.ocfs2/Makefile
index 1a3da8e..20bc1e2 100644
--- a/tunefs.ocfs2/Makefile
+++ b/tunefs.ocfs2/Makefile
@@ -11,16 +11,66 @@ LIBO2DLM_DEPS = $(TOPDIR)/libo2dlm/libo2dlm.a
LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
LIBO2CB_DEPS = $(TOPDIR)/libo2cb/libo2cb.a
+UNINST_LIBRARIES = libocfs2ne.a
+
+OCFS2NE_FEATURES = \
+ feature_backup_super \
+ feature_extended_slotmap \
+ feature_inline_data \
+ feature_local \
+ feature_sparse_files \
+ feature_unwritten_extents
+
+OCFS2NE_OPERATIONS = \
+ op_features \
+ op_list_sparse_files \
+ op_query \
+ op_reset_uuid \
+ op_resize_volume \
+ op_set_label \
+ op_set_journal_size \
+ op_set_slot_count \
+ op_update_cluster_stack
+
sbindir = $(root_sbindir)
-SBIN_PROGRAMS = tunefs.ocfs2
+SBIN_PROGRAMS = tunefs.ocfs2 ocfs2ne
INCLUDES = -I$(TOPDIR)/include -I.
DEFINES = -DVERSION=\"$(VERSION)\"
MANS = tunefs.ocfs2.8
-CFILES = \
- tunefs.c \
+ifneq ($(OCFS2_DEBUG_EXE),)
+DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
+DEBUG_EXE_PROGRAMS = $(addprefix debug_,$(subst .c,,$(DEBUG_EXE_FILES)))
+
+.SECONDARY:
+
+UNINST_PROGRAMS += $(filter-out debug_op_features,$(DEBUG_EXE_PROGRAMS))
+
+debug_%.o : %.c
+ $(CC) $(CFLAGS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(LOCAL_CPPFLAGS) \
+ $(INCLUDES) $(DEFINES) \
+ -DDEBUG_EXE -o $@ -c $<
+
+debug_op_features: debug_op_features.o $(OCFS2NE_FEATURE_OBJS) libocfs2ne.a $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
+ $(LINK) $(LIBOCFS2_LIBS) $(UUID_LIBS) $(LIBO2DLM_LIBS) \
+ $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+
+debug_%: debug_%.o libocfs2ne.a $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
+ $(LINK) $(LIBOCFS2_LIBS) $(UUID_LIBS) $(LIBO2DLM_LIBS) \
+ $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+endif
+
+LIBOCFS2NE_CFILES = libocfs2ne.c
+HFILES_GEN = o2ne_err.h
+
+o2ne_err.c o2ne_err.h: o2ne_err.et
+ compile_et o2ne_err.et
+
+
+TUNEFS_CFILES = \
+ tunefs.c \
query.c \
remove_slot.c \
sparse_file.c \
@@ -29,13 +79,40 @@ CFILES = \
format_slotmap.c \
inline_data.c
-HFILES = tunefs.h
+OCFS2NE_OPERATION_CFILES = $(patsubst %,%.c,$(OCFS2NE_OPERATIONS))
+OCFS2NE_FEATURE_CFILES = $(patsubst %,%.c,$(OCFS2NE_FEATURES))
+OCFS2NE_CFILES = \
+ ocfs2ne.c \
+ $(OCFS2NE_OPERATION_CFILES) \
+ $(OCFS2NE_FEATURE_CFILES)
+
+CFILES = $(TUNFES_CFILES) $(LIBOCFS2NE_CFILES) $(OCFS2NE_CFILES)
+HFILES = tunefs.h libocfs2ne.h
+
+TUNEFS_OBJS = $(subst .c,.o,$(TUNEFS_CFILES))
+LIBOCFS2NE_OBJS = $(subst .c,.o,$(LIBOCFS2NE_CFILES)) o2ne_err.o
+OCFS2NE_OBJS = $(subst .c,.o,$(OCFS2NE_CFILES))
-OBJS = $(subst .c,.o,$(CFILES))
+$(LIBOCFS2NE_OBJS): $(HFILES_GEN)
+$(OCFS2NE_OBJS): $(HFILES_GEN)
-DIST_FILES = $(CFILES) $(HFILES) tunefs.ocfs2.8.in
+DIST_FILES = $(CFILES) $(HFILES) tunefs.ocfs2.8.in o2ne_err.et
-tunefs.ocfs2: $(OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
+libocfs2ne.a: $(LIBOCFS2NE_OBJS)
+ rm -f $@
+ $(AR) r $@ $^
+ $(RANLIB) $@
+
+tunefs.ocfs2: $(TUNEFS_OBJS) $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
$(LINK) $(LIBOCFS2_LIBS) $(UUID_LIBS) $(LIBO2DLM_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+ocfs2ne: $(OCFS2NE_OBJS) libocfs2ne.a $(LIBOCFS2_DEPS) $(LIBO2DLM_DEPS) $(LIBO2CB_DEPS)
+ $(LINK) $(LIBOCFS2_LIBS) $(UUID_LIBS) $(LIBO2DLM_LIBS) \
+ $(LIBO2CB_LIBS) $(COM_ERR_LIBS)
+
+CLEAN_RULES = clean-err
+
+clean-err:
+ rm -f o2ne_err.c o2ne_err.h
+
include $(TOPDIR)/Postamble.make
--
1.5.6.3
More information about the Ocfs2-tools-devel
mailing list