Makefile 1.81 KB
Newer Older
1 2 3 4 5
SRCROOT = $(CURDIR)
include Makefile.common

build:
	$(MAKE) -C src $@
6 7 8

po:
	$(MAKE) -C po
9

Andrew Price's avatar
Andrew Price committed
10 11 12
# The non source files that should get installed
INSTALLFILES = colour help login.banner scripthelp talkhelp wizhelp COPYING INSTALL LICENSE README
install-home:
13 14
	install -d $(DESTDIR)$(libdir)/mw
	cp -a $(INSTALLFILES) $(DESTDIR)$(libdir)/mw/
Andrew Price's avatar
Andrew Price committed
15 16 17 18

ifeq ($(GITVER),)
# These rules can only be called from inside an exported tree
install: install-home
19 20
	install -d $(DESTDIR)$(initddir)
	install mwserv.init $(DESTDIR)$(initddir)/mwserv
21 22 23 24 25
	$(MAKE) -C src $@
	$(MAKE) -C po $@

deb:
	cp -a debian-template debian
26
	cp mw.service debian/mw3.service
27
	dch --create --package mw3 -v $(VERSION) -c debian/changelog "Build mw3 $(VERSION) package"
28
	debuild -e VERSION=$(VERSION) -us -uc -b
29 30 31 32

tarball:
	tar zchvf ../$(MWVERSION).tar.gz -C .. $(MWVERSION)

33
rpm: tarball
34 35 36 37 38 39 40 41
	rpmbuild -ta ../$(MWVERSION).tar.gz

else
# These rules can only be called from an svn working directory
ifdef TMPDIR
# A temp dir exists so svn export and palm off the invocation to the exported makefile
export:
	rm -rf $(TMPDIR)/$(MWVERSION)
42
	git checkout-index -a -f --prefix=$(TMPDIR)/$(MWVERSION)/
43
	# Store the git hash so we know it in the exported directory
44
	echo $(GITVER) > $(TMPDIR)/$(MWVERSION)/mw.rev
45 46 47 48

install tarball rpm: export
	$(MAKE) -C $(TMPDIR)/$(MWVERSION) $@
	rm -rf $(TMPDIR)/$(MWVERSION)
49 50

deb: export
51
	$(MAKE) -C $(TMPDIR)/$(MWVERSION) $@
52 53
	mv $(TMPDIR)/mw3_$(VERSION)*.deb $(CURDIR)/
	mv $(TMPDIR)/mw3-dbg_$(VERSION)*.deb $(CURDIR)/
54 55 56 57 58 59 60
	rm -rf $(TMPDIR)/$(MWVERSION)
else
# A temp dir doesn't exist so create it and invoke this makefile again
install deb export tarball rpm:
	$(MAKE) TMPDIR=`mktemp -d` $@

endif
61 62
endif

63
clean:
64
	$(MAKE) -C src $@
65
	$(MAKE) -C duktape $@
66
	$(MAKE) -C po $@
67

68 69 70
version:
	@echo $(VERSION)

Andrew Price's avatar
Andrew Price committed
71
.PHONY: build clean rpm deb tarball export install-home install version