File: Makefile

package info (click to toggle)
crossroads 2.65-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,664 kB
  • ctags: 355
  • sloc: cpp: 4,212; perl: 1,658; xml: 269; makefile: 186; sh: 46
file content (105 lines) | stat: -rw-r--r-- 3,342 bytes parent folder | download | duplicates (2)
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
# Top-level Makefile for XR
# -------------------------

VER	   = 2.65
PREFIX	   = $(DESTDIR)/usr
BINDIR	   = $(PREFIX)/sbin
MANDIR	   = $(PREFIX)/share/man
TAR	   = /tmp/crossroads-$(VER).tar.gz
AUTHOR     = Karel Kubat <karel@kubat.nl>
MAINTAINER = Karel Kubat <karel@kubat.nl>
DISTSITE   = http://crossroads.e-tunity.com
BASE	   = $(shell pwd)

foo:
	@echo
	@echo 'Choose:'
	@echo ' make local     - local program construction'
	@echo ' make localprof - local, with profiling info'
	@echo ' make localmem  - local, with memory debugging'
	@echo ' make install   - installation to $(BINDIR)'
	@echo ' make uninstall - removes installed programs'
	@echo ' make clean     - removal after local/install'
	@echo ' make tar       - pack sources in an archive'
	@echo ' make commit    - commit to repository (maintainer only)'
	@echo

local:
	mkdir -p xr/build
	xr/etc/gettools /usr/local/bin xr/etc c-conf e-ver
	xr/etc/e-ver ChangeLog $(VER)
	BASE=$(BASE) AUTHOR='$(AUTHOR)' MAINTAINER='$(MAINTAINER)' \
	  DISTSITE='$(DISTSITE)' MEMDEBUG=$(MEMDEBUG)\
	  VER='$(VER)' PROF=$(PROF) PROFILER=$(PROFILER) $(MAKE) -C xr

localprof:
	PROF=-pg PROFILER=-DPROFILER make local

localmem:
	MEMDEBUG=-DMEMDEBUG make local

install: local $(BINDIR)/xrctl install-manpages
	mkdir -p $(BINDIR)
	BASE=$(BASE) AUTHOR='$(AUTHOR)' MAINTAINER='$(MAINTAINER)' \
	  DISTSITE='$(DISTSITE)' \
	  VER='$(VER)' BINDIR=$(BINDIR) $(MAKE) -C xr install
	@echo
	@echo '  The balancer program xr is now installed to $(BINDIR).'
	@echo '  The control script xrctl is installed there too. In order to'
	@echo '  use it, you will have to create /etc/xrctl.xml (if you have'
	@echo '  not done so yet). See "man xrctl.xml" for an example.'
	@echo 
	@echo '  Have fun with Crossroads $(VER),'
	@echo '    -- $(MAINTAINER)'
	@echo
$(BINDIR)/xrctl: xrctl/xrctl Makefile
	sed 's:__VER__:$(VER):' < xrctl/xrctl > $(BINDIR)/xrctl
	chmod +x $(BINDIR)/xrctl
install-manpages: $(MANDIR)/man1/xr.1 $(MANDIR)/man1/xrctl.1 \
		  $(MANDIR)/man5/xrctl.xml.5
$(MANDIR)/man1/xr.1: doc/xr.1
	mkdir -p $(MANDIR)/man1
	cp $< $@
$(MANDIR)/man1/xrctl.1: doc/xrctl.1
	mkdir -p $(MANDIR)/man1
	cp $< $@
$(MANDIR)/man5/xrctl.xml.5: doc/xrctl.xml.5
	mkdir -p $(MANDIR)/man5
	cp $< $@

uninstall:
	rm -f $(BINDIR)/xr $(BINDIR)/xrctl
	@echo
	@echo 'The balancer binary xr and the control script xrctl have been'
	@echo 'removed from $(BINDIR).'
	@echo
	@if [ -f /etc/xrctl.xml ] ; then \
	  echo 'The configuration /etc/xrctl.xml still exists. Remove this' ; \
	  echo 'by hand if you are sure you will not be needing it.'; \
	else \
	  echo 'Configuration /etc/xrctl.xml was not found. Maybe you have'; \
	  echo 'it in a different location or under a different name.'; \
	  echo 'If so, consider removing it by hand.'; \
	fi;
	@echo
	@echo 'XR was uninstalled!'

clean:
	rm -rf xr/build/*
	find . -name gmon.out -exec rm {} \;

tar: clean
	rm -rf $(TAR) /tmp/crossroads-$(VER)
	cd ..; cp -r crossroads /tmp/crossroads-$(VER)
	cd /tmp; tar czf $(TAR) \
	  --exclude .git --exclude .svn --exclude crossroads-$(VER)/xr/build \
	  crossroads-$(VER)
	rm -rf /tmp/crossroads-$(VER)
	@echo
	@echo 'Sources now tarred into $(TAR)'

commit: local clean
	test `svn status | grep '^\?' | wc -l` -eq 0 || \
		(echo 'SVN not fully up to date: run "svn status"' && exit 1)
	perl -c xrctl/xrctl
	svn -m $(VER) commit