Skip to content

Commit

Permalink
Makefile: break out local targets into variables
Browse files Browse the repository at this point in the history
To support more than one set of local-* rules, break them out into
sub-rules referenced by appending to variables. This will be used
when introducing the Cython-based librbd bindings that rely on
setup.py

Signed-off-by: Hector Martin <[email protected]>
  • Loading branch information
marcan committed Dec 1, 2015
1 parent 5113c96 commit 0f5ce5e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ include Makefile-env.am
SUBDIRS += ocf java
DIST_SUBDIRS += gmock ocf java

LOCAL_ALL =
LOCAL_CLEAN =
LOCAL_INSTALLDATA =
LOCAL_INSTALLEXEC =

if NO_GIT_VERSION
export NO_VERSION="yes"
endif
Expand Down Expand Up @@ -192,11 +197,12 @@ CLEANFILES += ceph_ver.h sample.fetch_config

# cleaning

clean-local::
base-clean-local::
rm -f *.so
find . -name '*.gcno' -o -name '*.gcda' -o -name '*.lcov' -o -name "*.o" -o -name "*.lo" | xargs rm -f
rm -f ceph java/java/com/ceph/crush/Bucket.class

LOCAL_CLEAN += base-clean-local

# pybind

Expand Down Expand Up @@ -242,11 +248,13 @@ if ENABLE_COVERAGE
-test/coverage.sh -d $(srcdir) -o check-coverage make check
endif

install-data-local:: install-coverage
base-install-data-local:: install-coverage
-mkdir -p $(DESTDIR)$(sysconfdir)/ceph
-mkdir -p $(DESTDIR)$(localstatedir)/log/ceph
-mkdir -p $(DESTDIR)$(localstatedir)/lib/ceph/tmp

LOCAL_INSTALLDATA += base-install-data-local

uninstall-local:: uninstall-coverage
-rmdir -p $(DESTDIR)$(sysconfdir)/ceph/
-rmdir -p $(DESTDIR)$(localstatedir)/log/ceph
Expand Down Expand Up @@ -277,3 +285,9 @@ if ENABLE_SERVER
include Makefile-server.am
endif

# local targets

all-local: $(LOCAL_ALL)
clean-local: $(LOCAL_CLEAN)
install-exec-local: $(LOCAL_INSTALLEXEC)
install-data-local: $(LOCAL_INSTALLDATA)
10 changes: 7 additions & 3 deletions src/ceph-detect-init/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ EXTRA_DIST += \
ceph-detect-init/tests/test_all.py \
ceph-detect-init/tox.ini

all-local::
ceph-detect-init-all:
cd $(srcdir)/ceph-detect-init ; python setup.py build

clean-local::
ceph-detect-init-clean:
cd $(srcdir)/ceph-detect-init ; python setup.py clean ; rm -fr wheelhouse .tox build .coverage *.egg-info

install-data-local::
ceph-detect-init-install-data:
cd $(srcdir)/ceph-detect-init ; \
if test "$(DESTDIR)" ; then \
if lsb_release -si | grep --quiet 'Ubuntu\|Debian\|Devuan' ; then \
Expand All @@ -70,3 +70,7 @@ install-data-local::
root="--root=$(DESTDIR)" ; \
fi ; \
python setup.py install $$root $$options

LOCAL_ALL += ceph-detect-init-all
LOCAL_CLEAN += ceph-detect-init-clean
LOCAL_INSTALLDATA += ceph-detect-init-install-data

0 comments on commit 0f5ce5e

Please sign in to comment.