File: Makefile

package info (click to toggle)
nice 0.9.13-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,284 kB
  • ctags: 6,893
  • sloc: java: 42,767; xml: 3,508; lisp: 1,084; sh: 742; makefile: 670; cpp: 21; awk: 3
file content (113 lines) | stat: -rw-r--r-- 4,199 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
106
107
108
109
110
111
112
113
VERSION = ${shell expr "`head -1 ../NEWS`" : '.*(\(.*\))'}

# Get the version from the debian changelog.
FULL_DEB_VERSION = ${shell expr "`head -1 ../debian/changelog`" : '.*(\(.*\))'}
DEB_VERSION = ${shell expr "$(FULL_DEB_VERSION)" : '\(.*\)-[^-]*'}
DEBIAN_REVISION = ${shell expr "$(FULL_DEB_VERSION)" : '.*-\([^-]*\)'}

CVS_TAG = $(shell echo -n "version_$(VERSION)" | tr -c -- "-_a-zA-Z0-9" "_")

DEB = nice_${FULL_DEB_VERSION}_all.deb

BUILDROOT = nice-$(VERSION)
BUILDDIR = ${CURDIR}/$(BUILDROOT)

BUILTSOURCEFILE = nice_$(VERSION).orig.tar.gz
TARFILE = Nice-${VERSION}-unix.tar.gz
SOURCEFILE = Nice-${VERSION}-source.tgz

ZIPFILE = Nice-${VERSION}-windows.zip
ZIP_ROOT = tmp/Nice

RPMTMP  = ${CURDIR}/tmp/Nice-${VERSION}
RPMDIR  = ${CURDIR}/tmp/noarch
RPMFILE = Nice-${VERSION}-1.noarch.rpm

CVSROOT=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nice 
DOWNLOADROOT = http://prdownloads.sourceforge.net/nice

clean-tmp = rm -rf tmp && mkdir tmp

all: deb tar zip rpm

deb $(DEB):
	@[ $(VERSION) ] || ( echo "No version in NEWS file"; false )
	@[ $(VERSION) = "$(DEB_VERSION)" ] ||\
		 (echo "Upstream and Debian versions not matching"; false )
	@echo Creating Debian package version ${VERSION}
	rm -rf $(BUILDROOT) $(BUILDROOT).orig
	cd .. && cvs tag -d $(CVS_TAG) && cvs tag $(CVS_TAG)
	CVSROOT=$(CVSROOT) cvs export -d $(BUILDROOT).orig -r $(CVS_TAG) Nice
	mv -f $(BUILDROOT).orig/debian $(BUILDROOT).orig-debian
	find $(BUILDROOT).orig -name '.cvsignore' | xargs rm
	cp ../share/java/nice.jar $(BUILDROOT).orig/external/nice-bootstrap.jar
	tar zcf $(BUILTSOURCEFILE) $(BUILDROOT).orig
	mv $(BUILDROOT).orig-debian $(BUILDROOT).orig/debian
	mv $(BUILDROOT).orig $(BUILDROOT)
	cd $(BUILDROOT) && dpkg-buildpackage -us -uc -rfakeroot -sa


.PHONY: tar
tar ${TARFILE}: $(DEB)
	${clean-tmp} && mkdir tmp/$(BUILDROOT)
	cd $(BUILDROOT) && $(MAKE) install PREFIX=${CURDIR}/tmp/$(BUILDROOT)
	# Preprend a specific message for manual installations
	echo -e \
	 ';; Load this file from your .emacs file with:\n' \
	 ';;   (load "/usr/local/share/emacs/site-lisp/nice/nice-startup.el")'\
         '\n\n(setq load-path (cons "/usr/local/share/emacs/site-lisp/nice" load-path))\n\n' \
	> ${CURDIR}/tmp/$(BUILDROOT)/share/emacs/site-lisp/nice/nice-startup.el
	cat $(BUILDROOT)/lib/emacs/nice-startup.el \
	>>${CURDIR}/tmp/$(BUILDROOT)/share/emacs/site-lisp/nice/nice-startup.el
	cd tmp && tar --owner=0 --group=0 -czf ../${TARFILE} $(BUILDROOT)

.PHONY: rpm
rpm ${RPMDIR}/${RPMFILE}: $(DEB)
	${clean-tmp}
	cp rpmmacros ~/.rpmmacros
	mkdir -p ${RPMTMP}
	mkdir -p tmp/BUILD
	cd $(BUILDROOT) && $(MAKE) install\
		PREFIX=${RPMTMP}/usr \
		LISPDIR=${RPMTMP}/usr/share/emacs/site-lisp
	cd tmp && tar zcf ${CURDIR}/tmp/Nice-${VERSION}.tar.gz Nice-${VERSION}
	sed "s/VERSION/${VERSION}/" Nice.spec > tmp/Nice-${VERSION}.spec
	rpmbuild --target=noarch --buildroot=${RPMTMP} -bb tmp/Nice-${VERSION}.spec


WIN_TEXT_FILES = ${BUILDDIR}/{bin/{nicec,nicedoc,niceunit,niceclasspath}.bat,web/Readme.txt}

.PHONY: zip
zip ${ZIPFILE}: $(DEB)
	${clean-tmp}
	mkdir ${ZIP_ROOT}
	../bin/nicec --man | groff -mandoc -Thtml - > ${ZIP_ROOT}/nicec.html
#	Make sure that the files are in DOS mode
	unix2dos -p ${WIN_TEXT_FILES} ${ZIP_ROOT}/nicec.html
	ln -sf ${WIN_TEXT_FILES} ${BUILDDIR}/share/java/nice.jar ${ZIP_ROOT}
	mkdir -p ${ZIP_ROOT}/Emacs
	ln -sf ${BUILDDIR}/lib/emacs/*.el ${ZIP_ROOT}/Emacs
	-rm ${ZIPFILE}
	cd tmp && zip -r ../${ZIPFILE} Nice

#### SEND

send: ${TARFILE} ${ZIPFILE} ${RPMDIR}/${RPMFILE}
	(echo user anonymous bonniot@users.sf.net; \
         echo binary; echo cd incoming; \
         echo put ${TARFILE}; echo put ${ZIPFILE}; \
         echo put ${DEB}; echo put ${BUILTSOURCEFILE} ${SOURCEFILE}; \
	 echo lcd ${RPMDIR}; echo put ${RPMFILE} \
	)\
        | ftp -n upload.sourceforge.net

htaccess:
	echo -e "DirectoryIndex index.php index.html\n"\
"Redirect /Wiki http://nice.sourceforge.net/cgi-bin/twiki/view\n"\
"Redirect /Nice.tar $(DOWNLOADROOT)/${TARFILE}\n"\
"Redirect /Nice-source.tar.gz $(DOWNLOADROOT)/${SOURCEFILE}\n"\
"Redirect /Nice.zip $(DOWNLOADROOT)/${ZIPFILE}\n"\
"Redirect /nice.deb $(DOWNLOADROOT)/${DEB}\n"\
"Redirect /nice.rpm $(DOWNLOADROOT)/${RPMFILE}"\
	> ../web/.htaccess