49555b895f43ebf8b4f4b1f5367b5224bea420bb
[xonotic/gmqcc.git] / distro / Makefile
1 DROPBOX := dropbox_uploader.sh
2 UNAME   := $(shell uname -m)
3 DOWNLOAD:= ../doc/html/download.c
4 BRANCH  := $(shell git branch | sed -n -e 's/^\* \(.*\)/\1/p')
5 ifneq ($(shell uname -m), x86_64)
6     $(error Cannot build packages without an x86_64 capable CPU)
7 endif
8
9 .NOTPARALLEL: base
10 .NOTPARALLEL: upload
11
12 base:
13         $(MAKE) -C deb/
14         $(MAKE) -C deb/ CARCH=i686
15         $(MAKE) -C archlinux/this/
16         $(MAKE) -C archlinux/this/ CARCH=i686
17         $(MAKE) -C win32/
18         $(MAKE) -C slackware/this/
19         $(MAKE) -C slackware/this/ CARCH=i686
20         @mv deb/*.deb ./
21         @mv archlinux/this/*pkg.tar.xz ./
22         @mv win32/*.zip ./
23         @mv slackware/this/*.txz ./
24
25 upload:
26         @echo "APPKEY:76vh3q42hnvmzm3" > dropbox_config
27         @echo "APPSECRET:tmeecht2cmh72xa" >> dropbox_config
28         @echo "ACCESS_LEVEL:sandbox" >> dropbox_config
29         @echo "OAUTH_ACCESS_TOKEN:w0bxzf0dft8edfq" >> dropbox_config
30         @echo "OAUTH_ACCESS_TOKEN_SECRET:9vosx7x8gy4kgjk" >> dropbox_config
31         @wget -q "http://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh"
32         @chmod +x dropbox_uploader.sh
33         @sed -i -e "s/~\/.dropbox_uploader/.\/dropbox_config/g" $$(basename $(DROPBOX))
34         @find . -type f -regex ".*/.*\.\(xz\|deb\|zip\|txz\)" -exec ./$$(basename $(DROPBOX)) upload {} \;
35         @rm dropbox_config dropbox_uploader.sh
36
37 website:
38         $(CC) $(DOWNLOAD) -o html.gen
39         @./html.gen ../
40         @rm html.gen
41         @git stash
42         @git checkout gh-pages
43         @rm -f ../download.html
44         @mv -f download.html ../download.html
45         @cd ..; git add download.html; git commit -m 'update download page'; git push origin gh-pages;
46         @git checkout $(BRANCH)
47         @git stash apply
48
49 clean:
50         @rm -f *.deb
51         @rm -f *.pkg.tar.xz
52         @rm -f *.zip
53         @rm -f *.gen
54         @rm -f *.html
55         @rm -f *.txz
56
57 all: base upload