summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-01-30 11:04:16 +0100
committerDavid Sterba <dsterba@suse.com>2017-03-08 13:00:46 +0100
commit732056e3d3a35fad43515d5d7a87dc8572ae097e (patch)
tree4312ddb4268c3626b52789b78fa022a7c67dde0d
parent0c49ff5fb50347e1e381a9e0a351ee16d3e39735 (diff)
btrfs-progs: build: split makefile to generated and stable parts
It's not really necessary to configure and regenerate Makefiles in cases like adding a new source file. The build environment and optional features are not affected by that. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--.gitignore2
-rw-r--r--Makefile (renamed from Makefile.in)35
-rw-r--r--Makefile.inc.in36
-rw-r--r--configure.ac2
4 files changed, 47 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
index 98b3657b..7d4404c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,7 +67,7 @@ cscope.out
.clang_complete
depcomp
libtool
-Makefile
+Makefile.inc
Documentation/Makefile
missing
mkinstalldirs
diff --git a/Makefile.in b/Makefile
index 3813c994..18e4e82b 100644
--- a/Makefile.in
+++ b/Makefile
@@ -37,19 +37,15 @@
# Export all variables to sub-makes by default
export
-include Makefile.extrawarn
+-include Makefile.inc
+ifneq ($(MAKEFILE_INC_INCLUDED),yes)
+$(error Makefile.inc not generated, please configure first)
+endif
-CC = @CC@
-LN_S = @LN_S@
-AR = @AR@
-RM = @RM@
-RMDIR = @RMDIR@
-INSTALL = @INSTALL@
-DISABLE_DOCUMENTATION = @DISABLE_DOCUMENTATION@
-DISABLE_BTRFSCONVERT = @DISABLE_BTRFSCONVERT@
-BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
TAGS_CMD := ctags
+include Makefile.extrawarn
+
EXTRA_CFLAGS :=
EXTRA_LDFLAGS :=
@@ -60,7 +56,7 @@ DEBUG_CFLAGS :=
TOPDIR := $(shell pwd)
# Common build flags
-CFLAGS = @CFLAGS@ \
+CFLAGS = $(SUBST_CFLAGS) \
-include config.h \
-DBTRFS_FLAT_INCLUDES \
-D_XOPEN_SOURCE=700 \
@@ -72,19 +68,15 @@ CFLAGS = @CFLAGS@ \
$(DEBUG_CFLAGS_INTERNAL) \
$(EXTRA_CFLAGS)
-LDFLAGS = @LDFLAGS@ \
+LDFLAGS = $(SUBST_LDFLAGS) \
-rdynamic -L$(TOPDIR) $(EXTRA_LDFLAGS)
-LIBS_BASE = @UUID_LIBS@ @BLKID_LIBS@ -L. -pthread
-LIBS_COMP = @ZLIB_LIBS@ @LZO2_LIBS@
LIBS = $(LIBS_BASE)
LIBBTRFS_LIBS = $(LIBS_BASE)
# Static compilation flags
STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections
STATIC_LDFLAGS = -static -Wl,--gc-sections
-STATIC_LIBS_BASE = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ -L. -pthread
-STATIC_LIBS_COMP = @ZLIB_LIBS_STATIC@ @LZO2_LIBS_STATIC@
STATIC_LIBS = $(STATIC_LIBS_BASE)
# don't use FORTIFY with sparse because glibc with FORTIFY can
@@ -124,14 +116,6 @@ TESTS = fsck-tests.sh convert-tests.sh
udev_rules = 64-btrfs-dm.rules
-prefix ?= @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-libdir ?= @libdir@
-incdir = @includedir@/btrfs
-udevdir = @UDEVDIR@
-udevruledir = ${udevdir}/rules.d
-
ifeq ("$(origin V)", "command line")
BUILD_VERBOSE = $(V)
endif
@@ -201,7 +185,6 @@ endif
# external libs required by various binaries; for btrfs-foo,
# specify btrfs_foo_libs = <list of libs>; see $($(subst...)) rules below
-btrfs_convert_libs = @EXT2FS_LIBS@ @COM_ERR_LIBS@
btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
btrfs_debug_tree_objects = cmds-inspect-dump-tree.o
@@ -514,7 +497,7 @@ clean-doc:
clean-gen:
@echo "Cleaning Generated Files"
$(Q)$(RM) -rf -- version.h config.status config.cache connfig.log \
- configure.lineno config.status.lineno Makefile \
+ configure.lineno config.status.lineno Makefile.inc \
Documentation/Makefile tags \
config.log config.h config.h.in~ aclocal.m4 \
configure autom4te.cache/ config/
diff --git a/Makefile.inc.in b/Makefile.inc.in
new file mode 100644
index 00000000..4e1b68cb
--- /dev/null
+++ b/Makefile.inc.in
@@ -0,0 +1,36 @@
+# Variables set during configure phase:
+# * build environment, paths
+# * features (eg. convert, documentation)
+export
+
+CC = @CC@
+LN_S = @LN_S@
+AR = @AR@
+RM = @RM@
+RMDIR = @RMDIR@
+INSTALL = @INSTALL@
+DISABLE_DOCUMENTATION = @DISABLE_DOCUMENTATION@
+DISABLE_BTRFSCONVERT = @DISABLE_BTRFSCONVERT@
+BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
+
+SUBST_CFLAGS = @CFLAGS@
+SUBST_LDFLAGS = @LDFLAGS@
+
+LIBS_BASE = @UUID_LIBS@ @BLKID_LIBS@ -L. -pthread
+LIBS_COMP = @ZLIB_LIBS@ @LZO2_LIBS@
+STATIC_LIBS_BASE = @UUID_LIBS_STATIC@ @BLKID_LIBS_STATIC@ -L. -pthread
+STATIC_LIBS_COMP = @ZLIB_LIBS_STATIC@ @LZO2_LIBS_STATIC@
+
+prefix ?= @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir ?= @libdir@
+incdir = @includedir@/btrfs
+udevdir = @UDEVDIR@
+udevruledir = ${udevdir}/rules.d
+
+# external libs required by various binaries; for btrfs-foo,
+# specify btrfs_foo_libs = <list of libs>; see $($(subst...)) rules in Makefile
+btrfs_convert_libs = @EXT2FS_LIBS@ @COM_ERR_LIBS@
+
+MAKEFILE_INC_INCLUDED = yes
diff --git a/configure.ac b/configure.ac
index b08bfe60..30055f85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,7 +198,7 @@ AC_SUBST([LIBBTRFS_PATCHLEVEL])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
-Makefile
+Makefile.inc
Documentation/Makefile
version.h
])