Makefile (3073B)
1 # Top-level Makefile for XR 2 # ------------------------- 3 4 VER ?= 2.81 5 PREFIX ?= $(DESTDIR)/usr 6 BINDIR ?= $(PREFIX)/sbin 7 MANDIR ?= $(PREFIX)/share/man 8 TAR ?= /tmp/crossroads-$(VER).tar.gz 9 AUTHOR ?= Karel Kubat <karel@kubat.nl> 10 MAINTAINER ?= Karel Kubat <karel@kubat.nl> 11 DISTSITE ?= http://crossroads.e-tunity.com 12 BASE ?= $(shell pwd) 13 14 foo: 15 @cat xr/etc/make.help 16 17 local: 18 mkdir -p xr/build 19 xr/etc/gettools /usr/local/bin xr/etc c-conf e-ver 20 xr/etc/e-ver ChangeLog $(VER) 21 BASE=$(BASE) AUTHOR='$(AUTHOR)' MAINTAINER='$(MAINTAINER)' \ 22 DISTSITE='$(DISTSITE)' MEMDEBUG=$(MEMDEBUG)\ 23 VER='$(VER)' PROF=$(PROF) PROFILER=$(PROFILER) $(MAKE) -C xr 24 25 localprof: 26 PROF=-pg PROFILER=-DPROFILER make local 27 28 localmem: 29 MEMDEBUG=-DMEMDEBUG make local 30 31 install: local $(BINDIR)/xrctl install-manpages 32 mkdir -p $(BINDIR) 33 BASE=$(BASE) AUTHOR='$(AUTHOR)' MAINTAINER='$(MAINTAINER)' \ 34 DISTSITE='$(DISTSITE)' \ 35 VER='$(VER)' BINDIR=$(BINDIR) $(MAKE) -C xr install 36 @echo 37 @echo ' The balancer program xr is now installed to $(BINDIR).' 38 @echo ' The control script xrctl is installed there too. In order to' 39 @echo ' use it, you will have to create /etc/xrctl.xml (if you have' 40 @echo ' not done so yet). See "man xrctl.xml" for an example.' 41 @echo 42 @echo ' Have fun with Crossroads $(VER),' 43 @echo ' -- $(MAINTAINER)' 44 @echo 45 $(BINDIR)/xrctl: xrctl/xrctl Makefile 46 sed 's:__VER__:$(VER):' < xrctl/xrctl > $(BINDIR)/xrctl 47 chmod +x $(BINDIR)/xrctl 48 install-manpages: $(MANDIR)/man1/xr.1 $(MANDIR)/man1/xrctl.1 \ 49 $(MANDIR)/man5/xrctl.xml.5 50 $(MANDIR)/man1/xr.1: doc/xr.1 51 mkdir -p $(MANDIR)/man1 52 cp $< $@ 53 $(MANDIR)/man1/xrctl.1: doc/xrctl.1 54 mkdir -p $(MANDIR)/man1 55 cp $< $@ 56 $(MANDIR)/man5/xrctl.xml.5: doc/xrctl.xml.5 57 mkdir -p $(MANDIR)/man5 58 cp $< $@ 59 60 uninstall: 61 rm -f $(BINDIR)/xr $(BINDIR)/xrctl 62 @echo 63 @echo 'The balancer binary xr and the control script xrctl have been' 64 @echo 'removed from $(BINDIR).' 65 @echo 66 @if [ -f /etc/xrctl.xml ] ; then \ 67 echo 'The configuration /etc/xrctl.xml still exists. Remove this' ; \ 68 echo 'by hand if you are sure you will not be needing it.'; \ 69 else \ 70 echo 'Configuration /etc/xrctl.xml was not found. Maybe you have'; \ 71 echo 'it in a different location or under a different name.'; \ 72 echo 'If so, consider removing it by hand.'; \ 73 fi; 74 @echo 75 @echo 'XR was uninstalled!' 76 77 clean: 78 rm -rf xr/build/* 79 find . -name gmon.out -exec rm {} \; 80 81 tar: clean 82 rm -rf $(TAR) /tmp/crossroads-$(VER) 83 cd ..; cp -r crossroads /tmp/crossroads-$(VER) 84 cd /tmp; tar czf $(TAR) \ 85 --exclude .git --exclude .svn --exclude crossroads-$(VER)/xr/build \ 86 crossroads-$(VER) 87 rm -rf /tmp/crossroads-$(VER) 88 @echo 89 @echo 'Sources now tarred into $(TAR)' 90 91 commit: local clean 92 test `svn status | grep '^\?' | wc -l` -eq 0 || \ 93 (echo 'SVN not fully up to date: run "svn status"' && exit 1) 94 test -f doc/xr.pdf || \ 95 (echo 'PDF version of the docs not present!' && exit 1) 96 test doc/xr.pdf -nt doc/xr.odt || \ 97 (echo 'PDF version of the docs is stale!!' && exit 1) 98 perl -c xrctl/xrctl 99 svn -m $(VER) commit