Clean up RPM spec for newer distributions
[clumanager.git] / Makefile
blobb638245a7f8a0609a132e24567d4756a8d13ad32
1 include Makefile.top
3 SUBDIRS=include src init.d doc librhcm
6 # Main build. We build static-libs in librhcm first because we do not want
7 # the cluster to be detached from the API library - that is, changing the
8 # API library should not break the cluster's internal stuff.
10 all: librhcm/sizes.h
11 make -C librhcm dynamic-clean static-libs
12 for subdir in $(SUBDIRS); do make -C $$subdir || exit 1; done
16 # Build the clumanager.spec file from clumanager.spec.in. Just a sed
17 # operation.
18 # Uses "VERSION" define from Makefile.top.
20 clumanager.spec: clumanager.spec.in Makefile.top
21 @[ -n "$(RELEASE)" ] || echo "RELEASE not defined; aborting"
22 @[ -n "$(RELEASE)" ] || exit 1
23 sed -e s/"##VERSION##"/$(VERSION)/g \
24 -e s/"##RELEASE##"/$(RELEASE)/g \
25 clumanager.spec.in > clumanager.spec
29 # RPM operations
31 srpm: rpmcommon
32 rm -f clumanager-$(VERSION)*src.rpm
33 [ -z "`/bin/ls *patch`" ] || cp *patch `pwd`/rpm_build
34 rpmbuild --define "_sourcedir `pwd`/rpm_build" \
35 --define "_srcrpmdir `pwd`/rpm_build" \
36 --define "_builddir `pwd`/rpm_build" \
37 --define "_rpmdir `pwd`/rpm_build" --nodeps -bs \
38 rpm_build/clumanager.spec
39 mv rpm_build/*rpm .
41 rpm: rpmcommon
42 rm -f clumanager-$(VERSION)*$(ARCH).rpm
43 rpmbuild --define "_sourcedir `pwd`/rpm_build" \
44 --define "_srcrpmdir `pwd`/rpm_build" \
45 --define "_builddir `pwd`/rpm_build" \
46 --define "_rpmdir `pwd`/rpm_build" --nodeps -bb \
47 rpm_build/clumanager.spec
48 mv rpm_build/*/*rpm .
50 gitrpms:
51 rm -f clumanager.spec
52 make RELEASE=0.1git`git log -1 | head -1 | cut -f2 -d' '` rpms
54 rpms: srpm rpm
55 rm -rf rpm_build
57 rpmcommon: librhcm/sizes.h rpm_build
59 rpm_build: tarball clumanager.spec librhcm/sizes.h
60 rm -rf $@
61 mkdir $@
62 cp clumanager-$(VERSION).tar.gz rpm_build
63 cp clumanager.spec rpm_build
67 # Tarball operations.
69 tarball: clumanager-$(VERSION).tar.gz librhcm/sizes.h
71 tarball-clean:
72 rm -f clumanager-*.tar.gz
74 clumanager-$(VERSION).tar.gz: librhcm/sizes.h
75 rm -rf clumanager-$(VERSION)
76 mkdir clumanager-$(VERSION)
77 cp Makefile* clumanager-$(VERSION)
78 cp COPYING ChangeLog clumanager.doxygen clumanager.spec.in \
79 clumanager-$(VERSION)
80 for subdir in $(SUBDIRS); do cp -a $$subdir clumanager-$(VERSION); done
81 make -C clumanager-$(VERSION) purge gitpurge
82 tar -czf clumanager-$(VERSION).tar.gz clumanager-$(VERSION)
83 rm -rf clumanager-$(VERSION)
86 # Spec file operations.
88 spec: clumanager.spec librhcm/sizes.h
92 # Pool cleaning operations.
94 spec-clean:
95 rm -f clumanager.spec
97 gitpurge:
98 find . -type d -name ".git" | xargs rm -rf
100 clean:
101 find . -name "*buildtest*" | xargs rm -f
102 rm -rf rpm_build
103 rm -f librhcm/sizes.h
104 for subdir in $(SUBDIRS); do make -C $$subdir clean || exit 1; done
106 maintainer-clean: dist-clean
108 distclean: purge
110 purge: clean tarball-clean spec-clean
111 rm -rf clumanager-api
112 rm -f ./clumanager*rpm
116 # Installation!
118 install:
119 for subdir in $(SUBDIRS); do make -C $$subdir install || exit 1; done
120 mkdir -p $(DOCDIR)
121 install -m 0644 COPYING $(DOCDIR)
122 install -m 0644 ChangeLog $(DOCDIR)
123 mkdir -p $(LOCKDIR)
124 echo "Member-wide lock files are stored here - do not remove" > \
125 $(LOCKDIR)/README.locks
128 # We generate this at build time.
130 librhcm/sizes.h:
131 make -C librhcm sizes.h