summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 56214a4d1fca0bf75ea9d8761de7e2585d1536b7 (plain)
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
MODVERSION=$(shell dpkg-parsechangelog -l../build/tcos-extra-modules/debian/changelog 2>/dev/null| awk '/^Version/ {print $$2}')

clean:
	rm -f *.deb *.changes *.tar.gz *.diff.gz *.dsc *.build



pkg:
	mkdir -p ../build
	cd ../build/ && rm -rf *.*
	@if [ "$(PKG)" = "" ]; then echo "Need pkg name PKG=xxxxxxx"; exit 1; fi
	@if [ "$(VER)" = "" ]; then echo "Need version VER=xxxxxxx"; exit 1; fi
	make targz PKG=$(PKG)
	mv *.gz ../build
	cd ../build && tar -zxf *.tar.gz
	@echo -e "\n\n\n\t Building for:\t $(VER) (ARCH=$(ARCH)) \n\n\n" && read || true
	cd ../build/*/ && dch && bash
	-cd ../build/*/ && make patch_$(VER)
	cd ../build/*/ && pdebuild-$(VER)



modules:
	@if [ "$(VER)" = "" ]; then echo "Need version VER=xxxxxxx"; exit 1; fi
	mkdir -p ../build
	rm -rf ../build/*

	cp -ra tcos-extra-modules ../build/
	rm -rf ../build/tcos-extra-modules/.git*
	(cd ../build/*/ && make patch_$(VER) && dch && bash)

	mv ../build/tcos-extra-modules ../build/tcos-extra-modules-$(MODVERSION)
	cd ../build && dpkg-source -b tcos-extra-modules-$(MODVERSION)

	pbuilder --build --architecture $(ARCH) --debbuildopts "-us -uc" --basetgz "/var/cache/pbuilder/$(VER)-$(ARCH).tgz" ../build/*dsc

#	make targz PKG=tcos-extra-modules
#	mv *.gz ../build
#	cd ../build && tar -zxf *.tar.gz
#	@echo -e "\n\n\n\t Building (ARCH=$(ARCH)) for:\t $(VER) \n\n\n" && read || true
#	-cd ../build/*/ && make patch_$(VER)
#	cd ../build/*/ && dch && bash
#	cd ../build/*/ && pdebuild-$(VER)
#	scripts/build.pkg.sh $(PKG) $(VER) i386
	

origpkg:
	@mkdir -p ../build
	@cd ../build/ && rm -rf *.*
	@if [ "$(PKG)" = "" ]; then echo "Need pkg name PKG=xxxxxxx"; exit 1; fi
	@if [ "$(VER)" = "" ]; then echo "Need version VER=xxxxxxx"; exit 1; fi
	@cd $(PKG) && make clean
	make targz PKG=$(PKG) ORIG=1
	@mv *.gz ../build
	@cd ../build && tar -zxf *.tar.gz
	@cp -ra "$(PKG)/debian" ../build/*/
	@rm -rf `find ../build/*/debian -type d -name .svn`
	@echo -e "\n\n\n\t Building ORIGINAL sources (ARCH=$(ARCH)) for:\t $(VER) \n\n\n" && read || true
	@cd ../build/*/ && dch && bash
	-cd ../build/*/ && make patch_$(VER)
	@cd ../build/*/ && pdebuild-$(VER) --debbuildopts "-sa"

targz: clean
	VERSION=`dpkg-parsechangelog -l$(PKG)/debian/changelog| awk '/^Version/ {print $$2}'| awk -F"-" '{print $$1}'`
	@echo "Building $(PKG) at version $(VERSION)"
	@rm -rf tmp 2> /dev/null
	@mkdir -p tmp/$(PKG)-$(VERSION)
	@cp -ra $(PKG)/* tmp/$(PKG)-$(VERSION)
	@rm -rf `find tmp/* -type d -name .svn`
	@if [ "$(ORIG)" = "1" ]; then echo "***DELETING Debian dir****"; rm -rf tmp/debian; fi
	@if [ "$(ORIG)" = "1" ]; then cd tmp && tar -czf ../$(PKG)_$(VERSION).orig.tar.gz $(PKG)-$(VERSION); fi
	@if [ "$(ORIG)" != "1" ]; then cd tmp && tar -czf ../$(PKG).$(VERSION).tar.gz $(PKG)-$(VERSION); fi
	@ls -l *.gz|| true
	@rm -rf tmp




#DISTROS:=unstable testing squeeze lenny natty maverick lucid
DISTROS:=unstable testing squeeze precise oneiric natty lucid
ARCHS=i386 amd64

allpkgs:
	@echo DISTROS=$(DISTROS)
	@echo ARCHS=$(ARCHS)
	@if [ "$(PKG)" = "" ]; then echo "Need to say PKG=foo "; exit 1; fi
	@for distro in $(DISTROS); do\
		echo "\n\n\t BUILD $(PKG) $$distro i386"; \
		echo $(ARCHS) | grep -q i386 && scripts/build.pkg.sh $(PKG) $$distro i386 || true ; \
		if grep Architecture $(PKG)/debian/control | grep -q any  && echo $(ARCHS) | grep -q amd64; then \
			scripts/build.pkg.sh $(PKG) $$distro amd64 || true ; \
		fi ;\
	done