forked from OpenZWave/open-zwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist.mk
136 lines (116 loc) · 4.36 KB
/
dist.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# dist.mk - make dist
# Lots of this is taken directly from Automake.
# User can override this.
# Valid values are gzip bzip2 zip
# Automake supplies compress and shar as well, but I suspect those are
# obsolete and I have left them out.
#DIST_FORMATS ?= bzip2
# Fun uses of wildcard. Some of these are probably bogus.
# install-sh -- should be legacy, probably, but configure looks for it.
# FIXME: common files, quagmire files, texinfo ... anything else?
# DISTFILES = $(quagmire/dist_sources) $(quagmire/dist-files) $(EXTRA_DIST)
distdir = openzwave-$(VERSION).$(VERSION_REV)
#$(if $(PACKAGE_TARNAME),$(if $(PACKAGE_VERSION),$(PACKAGE_TARNAME)-$(PACKAGE_VERSION),$(error PACKAGE_VERSION not defined)),$(error PACKAGE_TARNAME not defined))
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
# FIXME: gnits-like NEWS checking
distdir: cpp/src/vers.cpp
$(am__remove_distdir)
mkdir -p $(distdir)
@list='$(DISTFILES)'; for file in $$list; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
mkdir -p `dirname $(distdir)/$$file`; \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
.PHONY: distdir
GZIP_ENV = --best
# FIXME: gnu tar dependency
dist-gzip: distdir
tar chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
.PHONY: dist-gzip
# FIXME: gnu tar dependency
dist-bzip2: distdir
tar chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
.PHONY: dist-bzip2
dist-zip: distdir
rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
.PHONY: dist-zip
dist: $(addprefix dist-,$(DIST_FORMATS))
$(if $(DIST_FORMATS),,$(error DIST_FORMATS is empty))
$(am__remove_distdir)
.PHONY: dist
distcheck-hook:
echo $(BUILDDIR)
mkdir -p ../$(BUILDDIR)/cpp/build/
mkdir -p ../$(BUILDDIR)/cpp/examples/MinOZW/
cp Makefile ../$(BUILDDIR)
cp cpp/build/support.mk ../$(BUILDDIR)/cpp/build/
cp cpp/build/Makefile ../$(BUILDDIR)/cpp/build/
cp dist.mk ../$(BUILDDIR)
cp distfiles.mk ../$(BUILDDIR)
cp cpp/examples/MinOZW/Makefile ../$(BUILDDIR)/cpp/examples/MinOZW/
.PHONY: distcheck-hook
DISTCHECK_CONFIGURE_FLAGS ?=
# FIXME: should 'make dvi' in the check. should copy over commentary
# from automake.
# FIXME: support DIST_ARCHIVES stuff from automake as well
distcheck:
$(MAKE) DIST_FORMATS=bzip2 dist
bunzip2 -c $(distdir).tar.bz2 | tar xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`cd $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& $(MAKE) distcheck-hook \
&& cd $(distdir)/_build \
&& $(MAKE) -C ../ \
&& chmod -R a-w "$$dc_install_base" \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) DIST_FORMATS=bzip2 dist \
&& rm -rf $(distdir).tar.bz2 \
&& $(MAKE) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir).tar.bz2 archive ready for distribution"
.PHONY: distcheck
distuninstallcheck_listfiles = find . -type f -print
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
.PHONY: distuninstallcheck
distcleancheck_listfiles = find . -type f -print
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
.PHONY: distcleancheck