]> sourceware.org Git - lvm2.git/commitdiff
makefiles: correcting login of makefile
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 15 Dec 2018 00:55:11 +0000 (01:55 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 17 Dec 2018 09:55:20 +0000 (10:55 +0100)
Fixing some ordering issue with inclusion of common make.tmpl.
Correcting dependency calculation
Simplifying inclusive makefile

Makefile.in
base/Makefile
device_mapper/Makefile
libdm/Makefile.in
make.tmpl.in
scripts/Makefile.in
test/unit/Makefile
tools/Makefile.in

index e64836f747f2a72d67ea7d8855f753a99bc77fee..a5eb00442a8e5db46b91df84d0e603a46fc7795e 100644 (file)
@@ -43,16 +43,22 @@ DISTCLEAN_TARGETS += config.cache config.log config.status make.tmpl
 
 include make.tmpl
 
+include $(top_srcdir)/base/Makefile
+include $(top_srcdir)/device_mapper/Makefile
+include $(top_srcdir)/test/unit/Makefile
+
 libdm: include
 libdaemon: include
-lib: libdm libdaemon
+lib: libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET)
 daemons: lib libdaemon tools
-tools: lib libdaemon device-mapper
+scripts: lib
+tools: lib libdaemon
 po: tools daemons
 man: tools
 all_man: tools
 scripts: libdm
 test: tools daemons
+unit-test  run-unit-test: test
 
 lib.device-mapper: include.device-mapper
 libdm.device-mapper: include.device-mapper
@@ -174,11 +180,6 @@ endif
 
 endif
 
-# FIXME: Drop once top-level make is resolved
--include $(top_srcdir)/test/unit/Makefile
-include $(top_srcdir)/device_mapper/Makefile
-include $(top_srcdir)/base/Makefile
-
 ifneq ($(shell which ctags 2>/dev/null),)
 .PHONY: tags
 tags:
index 6050c3a2aca634c8fda1e637b93af7e97b379c6a..9f8bccca65a019ac6322c333cf20920c660f13d8 100644 (file)
@@ -14,7 +14,7 @@
 # Comment to build the advanced radix tree.
 #base/data-struct/radix-tree.o: CFLAGS += -DSIMPLE_RADIX_TREE
 
-# NOTE: this include only works as 'include' for toplevel Makefile
+# NOTE: this Makefile only works as 'include' for toplevel Makefile
 #       which defined all top_* variables
 
 BASE_SOURCE=\
@@ -22,24 +22,19 @@ BASE_SOURCE=\
        base/data-struct/list.c \
        base/data-struct/radix-tree.c
 
+BASE_TARGET = base/libbase.a
 BASE_DEPENDS = $(BASE_SOURCE:%.c=%.d)
 BASE_OBJECTS = $(BASE_SOURCE:%.c=%.o)
 CLEAN_TARGETS += $(BASE_DEPENDS) $(BASE_OBJECTS) \
        $(BASE_SOURCE:%.c=%.gcda) \
-       $(BASE_SOURCE:%.c=%.gcno)
+       $(BASE_SOURCE:%.c=%.gcno) \
+       $(BASE_TARGET)
 
-ifeq ("$(USE_TRACKING)","yes")
-ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
- help check check_local check_cluster check_lvmetad check_lvmpolld))
-       -include $(BASE_DEPENDS)
-endif
-endif
-
-$(BASE_OBJECTS): INCLUDES+=-I$(top_srcdir)/base/
-
-base/libbase.a: $(BASE_OBJECTS)
+$(BASE_TARGET): $(BASE_OBJECTS)
        @echo "    [AR] $@"
        $(Q) $(RM) $@
        $(Q) $(AR) rsv $@ $(BASE_OBJECTS) > /dev/null
 
-CLEAN_TARGETS += base/libbase.a
+ifeq ("$(DEPENDS)","yes")
+-include $(BASE_DEPENDS)
+endif
index fd2189a8c7d75043c6fb646c4ccb7265e9405d6c..d3b791eb57db4b05db29eb4e4200b8cef16cec5f 100644 (file)
@@ -10,7 +10,7 @@
 # along with this program; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-# NOTE: this include only works as 'include' for toplevel Makefile
+# NOTE: this Makefile only works as 'include' for toplevel Makefile
 #       which defined all top_* variables
 
 DEVICE_MAPPER_SOURCE=\
@@ -31,27 +31,22 @@ DEVICE_MAPPER_SOURCE=\
        device_mapper/vdo/status.c \
        device_mapper/vdo/vdo_target.c
 
+DEVICE_MAPPER_TARGET = device_mapper/libdevice-mapper.a
 DEVICE_MAPPER_DEPENDS = $(DEVICE_MAPPER_SOURCE:%.c=%.d)
 DEVICE_MAPPER_OBJECTS = $(DEVICE_MAPPER_SOURCE:%.c=%.o)
 CLEAN_TARGETS += $(DEVICE_MAPPER_DEPENDS) $(DEVICE_MAPPER_OBJECTS) \
        $(DEVICE_MAPPER_SOURCE:%.c=%.gcda) \
-       $(DEVICE_MAPPER_SOURCE:%.c=%.gcno)
+       $(DEVICE_MAPPER_SOURCE:%.c=%.gcno) \
+       $(DEVICE_MAPPER_TARGET)
 
 #$(DEVICE_MAPPER_DEPENDS): INCLUDES+=$(VDO_INCLUDES)
 #$(DEVICE_MAPPER_OBJECTS): INCLUDES+=$(VDO_INCLUDES)
 
-ifeq ("$(USE_TRACKING)","yes")
-ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
- help check check_local check_cluster check_lvmetad check_lvmpolld))
-       -include $(DEVICE_MAPPER_DEPENDS)
-endif
-endif
-
-$(DEVICE_MAPPER_OBJECTS): INCLUDES+=-I$(top_srcdir)/device_mapper/
-
-device_mapper/libdevice-mapper.a: $(DEVICE_MAPPER_OBJECTS)
+$(DEVICE_MAPPER_TARGET): $(DEVICE_MAPPER_OBJECTS)
        @echo "    [AR] $@"
        $(Q) $(RM) $@
        $(Q) $(AR) rsv $@ $(DEVICE_MAPPER_OBJECTS) > /dev/null
 
-CLEAN_TARGETS += device_mapper/libdevice-mapper.a
+ifeq ("$(DEPENDS)","yes")
+-include $(DEVICE_MAPPER_DEPENDS)
+endif
index 4ea83d0afb7358ac1b102afdfd47cf6139d43b34..e9bb5ae2fb2a9fc46e6c49541a3ed2dad5a4b45a 100644 (file)
@@ -58,7 +58,7 @@ include $(top_builddir)/libdm/make.tmpl
 
 PROGS_CFLAGS = $(UDEV_CFLAGS)
 
-LIBS += $(RT_LIBS) $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(M_LIBS)
+LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(RT_LIBS) $(M_LIBS)
 
 device-mapper: all
 
index d7b65689f2389625c026a4241c96db2cc20a769c..9158f0e12b7474c16c9a19c418aee4bfd655c6f4 100644 (file)
@@ -72,9 +72,6 @@ CLDFLAGS += @CLDFLAGS@
 ELDFLAGS += @ELDFLAGS@
 LDDEPS += @LDDEPS@
 LIB_SUFFIX = @LIB_SUFFIX@
-LVMINTERNAL_LIBS=\
-       -llvm-internal \
-       $(DAEMON_LIBS) $(DMEVENT_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
 DL_LIBS = @DL_LIBS@
 RT_LIBS = @RT_LIBS@
 M_LIBS = @M_LIBS@
@@ -266,13 +263,6 @@ endif
 # end of fPIC protection
 endif
 
-LDFLAGS += -L$(top_builddir)/lib
-CLDFLAGS += -L$(top_builddir)/lib
-
-DAEMON_LIBS = -ldaemonclient
-LDFLAGS += -L$(top_builddir)/libdaemon/client
-CLDFLAGS += -L$(top_builddir)/libdaemon/client
-
 ifeq ("@BUILD_DMEVENTD@", "yes")
   DMEVENT_LIBS = -ldevmapper-event
   LDFLAGS += -L$(top_builddir)/daemons/dmeventd
@@ -338,11 +328,13 @@ SUBDIRS.distclean := $(SUBDIRS:=.distclean)
 
 TARGETS += $(LIB_SHARED) $(LIB_STATIC)
 
-INTERNAL_LIBS=\
+INTERNAL_LIBS = \
+       $(top_builddir)/libdaemon/client/libdaemonclient.a \
        $(top_builddir)/device_mapper/libdevice-mapper.a \
        $(top_builddir)/base/libbase.a
-       
-all: $(INTERNAL_LIBS) $(SUBDIRS) $(TARGETS)
+LVMINTERNAL_LIBS = $(top_builddir)/lib/liblvm-internal.a $(INTERNAL_LIBS)
+
+all: $(SUBDIRS) $(TARGETS)
 
 install: all $(SUBDIRS.install)
 install_cluster: all $(SUBDIRS.install_cluster)
@@ -351,7 +343,7 @@ install_lvm2: $(SUBDIRS.install_lvm2)
 install_ocf: $(SUBDIRS.install_ocf)
 cflow: $(SUBDIRS.cflow)
 
-$(SUBDIRS): $(SUBDIRS.device-mapper) $(INTERNAL_LIBS)
+$(SUBDIRS): $(SUBDIRS.device-mapper)
        $(MAKE) -C $@
 
 $(SUBDIRS.device-mapper):
@@ -577,13 +569,15 @@ else
 endif
 
 ifeq ("$(USE_TRACKING)","yes")
-ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov \
- help check check_local check_cluster check_lvmpolld))
+ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
+ help check check_local check_cluster check_lvmpolld run-unit-test tags))
+# Note: no tabs before -include
     ifdef SOURCES
        -include $(SOURCES:.c=.d) $(CXXSOURCES:.cpp=.d)
     endif
     ifdef SOURCES2
        -include $(SOURCES2:.c=.d)
     endif
+    DEPENDS = yes
 endif
 endif
index ffca04a1444962c00a8f628bbdf5e22ea48c0650..e3843977ed45d00787e956e2f27cac38a5281726 100644 (file)
@@ -76,9 +76,9 @@ endif
 
 CFLAGS_lvm2_activation_generator_systemd_red_hat.o += $(EXTRA_EXEC_CFLAGS)
 
-lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(DEPLIBS) $(INTERNAL_LIBS)
+lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(LVMINTERNAL_LIBS)
        @echo "    [CC] $@"
-       $(Q) $(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) $(LVMLIBS) $(INTERNAL_LIBS) $(LIBS)
+       $(Q) $(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) $(LVMINTERNAL_LIBS) $(LIBS)
 
 install_systemd_generators:
        @echo "    [INSTALL] $<"
index 5b71e1bf592b9e7a0bd1ac53da766d653d79e352..0ff128da97a1453ac2688db35a0125c88070ac3d 100644 (file)
@@ -10,6 +10,9 @@
 # along with this program; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+# NOTE: this Makefile only works as 'include' for toplevel Makefile
+#       which defined all top_* variables
+
 UNIT_SOURCE=\
        device_mapper/vdo/status.c \
        \
@@ -31,27 +34,25 @@ UNIT_SOURCE=\
 
 test/unit/radix_tree_t.o: test/unit/rt_case1.c
 
+UNIT_TARGET = test/unit/unit-test
 UNIT_DEPENDS = $(UNIT_SOURCE:%.c=%.d)
 UNIT_OBJECTS = $(UNIT_SOURCE:%.c=%.o)
 CLEAN_TARGETS += $(UNIT_DEPENDS) $(UNIT_OBJECTS) \
        $(UNIT_SOURCE:%.c=%.gcda) \
        $(UNIT_SOURCE:%.c=%.gcno) \
-       test/unit/unit-test
+       $(UNIT_TARGET)
 
-test/unit/unit-test: $(UNIT_OBJECTS) lib/liblvm-internal.a libdaemon/client/libdaemonclient.a $(INTERNAL_LIBS)
+$(UNIT_TARGET): $(UNIT_OBJECTS) $(LVMINTERNAL_LIBS)
        @echo "    [LD] $@"
        $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) \
-             -o $@ $+ $(DMEVENT_LIBS) $(SYSTEMD_LIBS) $(LIBS) -laio
+             -o $@ $+ $(DMEVENT_LIBS) $(LIBS) -laio
 
 .PHONEY: run-unit-test unit-test
-unit-test: test/unit/unit-test
-run-unit-test: test/unit/unit-test
-       @echo Running unit tests
-       LD_LIBRARY_PATH=libdm test/unit/unit-test run
+unit-test: $(UNIT_TARGET)
+run-unit-test: $(UNIT_TARGET)
+       @echo "Running unit tests"
+       LD_LIBRARY_PATH=libdm $(UNIT_TARGET) run
 
-ifeq ("$(USE_TRACKING)","yes")
-ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov lcov-reset \
- help check check_local check_lvmpolld run-unit-test))
-       -include $(UNIT_DEPENDS)
-endif
+ifeq ("$(DEPENDS)","yes")
+-include $(UNIT_SOURCE:%.c=%.d)
 endif
index 09768ed71141a4fee8ac0872972d9778bfab53bf..b45798ea47f23ff58f2a8b2ddbebe18f0cb4994b 100644 (file)
@@ -89,8 +89,9 @@ ifeq ("@STATIC_LINK@", "yes")
   INSTALL_CMDLIB_TARGETS += install_cmdlib_static
 endif
 
-LVMLIBS = $(LVMINTERNAL_LIBS) -laio
+LVMLIBS = $(LIBS) -laio
 LIB_VERSION = $(LIB_VERSION_LVM)
+INCLUDES = -I$(top_builddir)/tools
 
 CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
        liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
@@ -118,10 +119,10 @@ all: device-mapper
 
 CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
 
-lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a $(INTERNAL_LIBS)
+lvm: $(OBJECTS) lvm.o $(LVMINTERNAL_LIBS)
        @echo "    [CC] $@"
        $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $+ \
-               $(LVMLIBS) $(READLINE_LIBS) $(LIBS) -lm
+               $(DMEVENT_LIBS) $(READLINE_LIBS) $(LVMLIBS)
 
 DEFS_man-generator.o += -DMAN_PAGE_GENERATOR
 
@@ -133,10 +134,10 @@ man-generator: man-generator.o
        @echo "    [CC] $@"
        $(Q) $(CC) $(CFLAGS) -o $@ $<
 
-lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a $(INTERNAL_LIBS)
+lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS)
        @echo "    [CC] $@"
-       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
-             $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
+       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
+             $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS)
 
 liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
        @echo "    [AR] $@"
@@ -153,7 +154,7 @@ liblvm2cmd.$(LIB_SUFFIX): liblvm2cmd.a $(LDDEPS)
        $(Q) $(CC) -shared -Wl,-soname,$@.$(LIB_VERSION) \
                $(CFLAGS) $(CLDFLAGS) -o $@ \
                @CLDWHOLEARCHIVE@ liblvm2cmd.a @CLDNOWHOLEARCHIVE@ \
-               $(LVMLIBS) $(INTERNAL_LIBS) $(LIBS)
+               $(LVMINTERNAL_LIBS) $(LVMLIBS)
 
 liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
        @echo "    [LN] $@"
This page took 0.049711 seconds and 5 git commands to generate.