Skip to content
Snippets Groups Projects
Commit 3735787e authored by Iustin Pop's avatar Iustin Pop
Browse files

Partial undo of "Makefile: Streamline directory creation"


Commit c964d962 changed the way we create directories, by two things:

- unifying all dependencies and ad-hoc directory creation into a
  single target (all_dirfiles)
- changing how directories are created from a stamp file to .dir files
  in each directory

The first item is a very good one, but the second item is debatable:
there's no per-se advantage of .dir files versus a single one,
top-level, since both the .dir file and stamp-directories creation are
depending on Makefile, which is the only one which can introduce new
directories.

On the other hand, moving back from .dir files to stamp-directories
has an advantage: "make -d | wc -l" does from ~8.7K lines to ~5.3K
lines, because we eliminate the many .dir files and their multiple
implicit and explicit dependencies (the %/.dir files fall under
multiple patterns).

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 5098afd1
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,6 @@
*.o
*.hi
*.hp
.dir
# /
/Makefile
......@@ -30,6 +29,7 @@
/epydoc.conf
/ganeti
/stamp-srclinks
/stamp-directories
/vcs-version
/*.patch
/*.tar.bz2
......
......@@ -115,8 +115,6 @@ DIRCHECK_EXCLUDE = \
ganeti-[0-9]*.[0-9]*.[0-9]* \
doc/html/_*
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
# some helper vars
COVERAGE_DIR = doc/coverage
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
......@@ -140,7 +138,6 @@ CLEANFILES = \
$(addsuffix /*.py[co],$(DIRS)) \
$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
$(addsuffix /*.o,$(HTOOLS_DIRS)) \
$(all_dirfiles) \
$(PYTHON_BOOTSTRAP) \
epydoc.conf \
$(REPLACE_VARS_SED) \
......@@ -153,6 +150,7 @@ CLEANFILES = \
$(man_MANS) \
$(manhtml) \
tools/kvm-ifup \
stamp-directories \
stamp-srclinks \
$(nodist_pkgpython_PYTHON) \
$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
......@@ -169,8 +167,8 @@ BUILT_SOURCES = \
built_base_sources = \
ganeti \
stamp-srclinks \
$(all_dirfiles)
stamp-directories \
stamp-srclinks
built_python_base_sources = \
lib/_autoconf.py \
......@@ -422,7 +420,7 @@ HS_LIB_SRCS = \
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
$(RUN_IN_TEMPDIR): | stamp-directories
# Note: we use here an order-only prerequisite, as the contents of
# _autoconf.py are not actually influencing the html build output: it
......@@ -1082,7 +1080,7 @@ htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
set -e; \
{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
lib/_autoconf.py: Makefile | lib/.dir
lib/_autoconf.py: Makefile | stamp-directories
set -e; \
{ echo '# This file is automatically generated, do not edit!'; \
echo '#'; \
......@@ -1154,7 +1152,7 @@ lib/_autoconf.py: Makefile | lib/.dir
echo "XEN_CMD = '$(XEN_CMD)'"; \
} > $@
lib/_vcsversion.py: Makefile vcs-version | lib/.dir
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
set -e; \
VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
{ echo '# This file is automatically generated, do not edit!'; \
......@@ -1213,7 +1211,7 @@ scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/%,%,$@)
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
$(PYTHON_BOOTSTRAP): Makefile | stamp-directories
test -n "$(MODULE)" || { echo Missing module; exit 1; }
set -e; \
{ echo '#!/usr/bin/python'; \
......@@ -1251,9 +1249,13 @@ $(HS_BUILT_TEST_HELPERS): Makefile
} > $@
chmod u+x $@
stamp-directories: Makefile
@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
touch $@
# We need to create symlinks because "make distcheck" will not install Python
# files when building.
stamp-srclinks: Makefile | $(all_dirfiles)
stamp-srclinks: Makefile | stamp-directories
set -e; \
for i in $(srclink_files); do \
if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
......@@ -1417,11 +1419,6 @@ install-exec-local:
"$(DESTDIR)${localstatedir}/log/ganeti" \
"$(DESTDIR)${localstatedir}/run/ganeti"
# To avoid conflicts between directory names and other targets, a file inside
# the directory is used to ensure its existence.
%.dir:
@mkdir_p@ $* && touch $@
.PHONY: apidoc
if WANT_HTOOLSAPIDOC
apidoc: py-apidoc hs-apidoc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment