#	Makefile for the galaxis game
# Flags for use with the Linux ncurses package (recommended)
CFLAGS = -g3 -DNDEBUG  # -I/usr/include -L/usr/$lib
TERMLIB = -lncurses
CC = gcc

# Flags for use with stock curses
#CFLAGS = -DNDEBUG
#TERMLIB = -lcurses
#CC = gcc

galaxis: galaxis.c
	$(CC) $(CFLAGS) -o galaxis galaxis.c $(TERMLIB)

galaxis.6: galaxis.xml
	xmlto man galaxis.xml
galaxis.html: galaxis.xml
	xmlto html-nochunks galaxis.xml

install: galaxis.6 uninstall
	install -Dm755 galaxis $(DESTDIR)/usr/bin/galaxis
	install -Dm644 galaxis.6 $(DESTDIR)/usr/share/man/man6/galaxis.6
	install -Dm644 galaxis.desktop $(DESTDIR)/usr/share/applications/galaxis.desktop
	
uninstall:
	rm -f ${ROOT}/usr/bin/galaxis ${ROOT}/usr/share/man/man6/galaxis.6

clean:
	rm -f galaxis galaxis.6 galaxis-*.tar.gz *~ *.html

SOURCES = README COPYING NEWS control galaxis.c Makefile galaxis.xml galaxis.desktop galaxis.png

galaxis-$(VERS).tar.gz: $(SOURCES) galaxis.6
	tar --transform='s:^:galaxis-$(VERS)/:' --show-transformed-names -cvzf galaxis-$(VERS).tar.gz $(SOURCES) galaxis.6

dist: galaxis-$(VERS).tar.gz

release: galaxis-$(VERS).tar.gz galaxis.html
	shipper version=$(VERS) | sh -e -x
