]> de.git.xonotic.org Git - xonotic/gmqcc.git/blob - distro/deb/Makefile
Fix windows builds, add strip target for makefiles, update distro build makefiles...
[xonotic/gmqcc.git] / distro / deb / Makefile
1 BASEDIR := ../..
2 PREFIX  := /usr
3 HEADER  := $(BASEDIR)/gmqcc.h
4 MAJOR   := `sed -n -e '/GMQCC_VERSION_MAJOR/{s/.* .* //;p;q;}' $(HEADER)`
5 MINOR   := `sed -n -e '/GMQCC_VERSION_MINOR/{s/.* .* //;p;q;}' $(HEADER)`
6 PATCH   := `sed -n -e '/GMQCC_VERSION_PATCH/{s/.* .* //;p;q;}' $(HEADER)`
7 DEBDIR  := gmqcc-$(MAJOR).$(MINOR).$(PATCH)
8 CARCH   := $(shell uname -m)
9 DEB     := $(DEBDIR)-$(CARCH).deb
10 CONTROL := $(DEBDIR)/DEBIAN/control
11
12 ifneq (, $(findstring i686, $(CARCH)))
13         CFLAGS += -m32
14         LDFLAGS += -m32
15 endif
16
17 base:
18         $(MAKE) -C $(BASEDIR) clean
19         CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
20           $(MAKE) -C $(BASEDIR) DESTDIR=distro/deb/$(DEBDIR) PREFIX=$(PREFIX) strip install
21         @install -d -m755 $(DEBDIR)/DEBIAN
22         @echo "Package: gmqcc" > $(CONTROL)
23         @echo "Version: $(MAJOR).$(MINOR).$(PATCH)" >> $(CONTROL)
24         @echo "Section: user/hidden" >> $(CONTROL)
25         @echo "Priority: optional" >> $(CONTROL)
26         @echo "Architecture: $(CARCH)" >> $(CONTROL)
27         @echo "Installed-Size: `du -ks $($(DEBDIR)/usr) | cut -f 1`" >> $(CONTROL)
28         @echo "Maintainer: Dale Weiler <killfieldengine@gmail.com>" >> $(CONTROL)
29         @echo "Description: An improved Quake C Compiler" >> $(CONTROL)
30         @echo "   For an enduring period of time the options for a decent compiler for the Quake C programming language" >> $(CONTROL)
31         @echo "   were confined to a specific compiler known as QCC. Attempts were made to extend and improve upon the" >> $(CONTROL)
32         @echo "   design of QCC, but many foreseen the consequences of building on a broken foundation. The solution" >> $(CONTROL)
33         @echo "   was obvious, a new compiler; one born from the NIH realm of sarcastic wit. We welcome you. You won't" >> $(CONTROL)
34         @echo "   find a better Quake C compiler." >> $(CONTROL)
35         @tar czf data.tar.gz -C $(DEBDIR)/ . --exclude=DEBIAN
36         @tar czf control.tar.gz -C $(DEBDIR)/DEBIAN/ .
37         @echo 2.0 > debian-binary
38         @ar r $(DEB) debian-binary control.tar.gz data.tar.gz
39         @rm -rf debian-binary control.tar.gz data.tar.gz $(DEBDIR)
40
41 clean:
42         $(MAKE) -C $(BASEDIR) clean
43         @rm -f *.deb
44
45 all: base