Modified archive generation for real
[meego-developer-tools:image-creator.git] / Makefile
1 # ex: set tabstop=4 noexpandtab
2 PKGNAME=mic2
3 SQUASH_VER=4.0cvs
4
5 DESTDIR=
6 PREFIX=/usr
7 VERSION := $(shell awk '/Version:/ { print $$2 }' spec/mic2.spec)
8
9 PYCHECKEROPTS=--no-shadowbuiltin --no-argsused --no-miximport --maxargs 0 --no-local -\# 0 --only
10
11 .PHONY: all
12 all: build
13
14 build: extra/squashfs-tools/mksquashfs.moblin 
15         python setup.py build
16
17 extra/squashfs-tools/mksquashfs.moblin: extra/squashfs-tools/squashfs-tools-${SQUASH_VER}.tar.bz2
18         @cd extra/squashfs-tools; tar xjpf squashfs-tools-${SQUASH_VER}.tar.bz2; \
19         cd squashfs-tools; $(MAKE); \
20         cp mksquashfs ../mksquashfs.moblin 
21         @rm -rf extra/squashfs-tools/squashfs-tools
22
23 squashfs-tools-install: extra/squashfs-tools/mksquashfs.moblin
24         install -d ${DESTDIR}${PREFIX}/bin/
25         install -m 755 extra/squashfs-tools/mksquashfs.moblin ${DESTDIR}${PREFIX}/bin/
26
27 squashfs-tools-clean:
28         rm -f extra/squashfs-tools/mksquashfs.moblin
29
30 moblin-syslinux-install:
31         install -d ${DESTDIR}${PREFIX}/bin/
32         install -m 755 extra/syslinux/isohybrid.moblin ${DESTDIR}${PREFIX}/bin/
33
34 install: squashfs-tools-install moblin-syslinux-install
35         python setup.py install --prefix=$(DESTDIR)$(PREFIX)
36
37 clean: squashfs-tools-clean
38         rm -f mic/*.pyc mic/imgcreate/*.pyc mic/appcreate/*.pyc mic/imgcreate/kscommands/*.pyc mic/ec2convert/*.pyc
39         rm -rf build
40         rm -f $(PKGNAME)-$(VERSION).tar.bz2
41
42 tag:
43         @git tag  -a -m "Tag as $(VERSION)" $(VERSION)
44         @echo "Tagged as $(VERSION)"
45
46 ChangeLog:
47         (GIT_DIR=.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog .' >&2)
48
49 archive: 
50         @rm -f ChangeLog
51         @make ChangeLog
52         @git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(VERSION)  > $(PKGNAME)-$(VERSION).tar
53         @tar --delete -f mic2-$(VERSION).tar mic2-$(VERSION)/debian 
54         @tar -zcf debian.tar.gz debian
55         @mkdir -p mic2-$(VERSION)
56         @cp ChangeLog mic2-$(VERSION)/
57         @tar --append -f mic2-$(VERSION).tar mic2-$(VERSION)
58         @gzip mic2-$(VERSION).tar
59         @rm -rf mic2-$(VERSION)
60
61 dist-rpm:
62         if [ ! -d /tmp/rpm_mic_packaging ]; then \
63                 mkdir /tmp/rpm_mic_packaging; cd /tmp/rpm_mic_packaging; mkdir RPMS SRPMS SPECS SOURCES BUILD; \
64         fi
65         git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ HEAD | gzip -9 > /tmp/rpm_mic_packaging/SOURCES/$(PKGNAME)-$(VERSION).tar.gz
66         rpmbuild -ba spec/mic.spec --clean --define "_topdir /tmp/rpm_mic_packaging"
67         if [ ! -d ./dist ]; then mkdir dist; fi
68         find /tmp/rpm_mic_packaging -name '*.rpm' -exec mv {} dist/ \;
69         rm -rf /tmp/rpm_mic_packaging
70
71 dist-deb:
72         dpkg-buildpackage -rfakeroot -uc -us -tc
73         echo "All the generated files are placed at parent directory"
74
75 dist-clean: clean
76         rm -rf dist/
77
78 .PHONY: clean install