summaryrefslogtreecommitdiff
path: root/Makefile
blob: 31f402b0a1fd596e7645f7c50e28116077ac468f (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
# See COPYING file for copyright, license and warranty details.

NAME = spout
SRC = spout.c
TARGETS = $(NAME)

OBJ = $(SRC:.c=.o)
MAN = $(TARGETS:=.1)

HEADERS = spout.h font.h sintable.h
WEB = web/index.html

include config.mk

all: $(TARGETS)

$(OBJ): config.mk $(HEADERS)

.c.o:
	@echo CC $<
	@cc -c $(CFLAGS) $<

$(TARGETS): $(OBJ)
	@echo LD $@
	@cc -o $@ $(OBJ) $(LDFLAGS)

$(WEB): web/doap.ttl
	@echo making webpage
	@sh web/makepage.sh "Spout - A simple caveflying game" web/doap.ttl > $(WEB)

clean:
	rm -f -- $(TARGETS) $(WEB) $(OBJ) $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION).tar.gz.sig

dist: clean
	@mkdir -p $(NAME)-$(VERSION)
	@cp -R $(SRC) $(HEADERS) Makefile config.mk COPYING README $(NAME)-$(VERSION)
	@for i in $(MAN); do \
		sed "s/VERSION/$(VERSION)/g" < $$i > $(NAME)-$(VERSION)/$$i; done
	@tar -c $(NAME)-$(VERSION) | gzip -c > $(NAME)-$(VERSION).tar.gz
	@gpg -b < $(NAME)-$(VERSION).tar.gz > $(NAME)-$(VERSION).tar.gz.sig
	@rm -rf $(NAME)-$(VERSION)
	@echo $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION).tar.gz.sig

install: all
	@echo installing executables to $(DESTDIR)$(PREFIX)/bin
	@mkdir -p $(DESTDIR)$(PREFIX)/bin
	@for i in $(TARGETS); do \
		cp -f $$i $(DESTDIR)$(PREFIX)/bin/$$i; \
		chmod 755 $(DESTDIR)$(PREFIX)/bin/$$i; done
	@echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man1
	@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
	@for i in $(MAN); do \
		sed "s/VERSION/$(VERSION)/g" < $$i > $(DESTDIR)$(MANPREFIX)/man1/$$i; \
		chmod 644 $(DESTDIR)$(MANPREFIX)/man1/$$i; done

uninstall:
	@echo uninstalling executables from $(DESTDIR)$(PREFIX)/bin
	@for i in $(TARGETS); do rm -f $(DESTDIR)$(PREFIX)/bin/$$i; done
	@echo uninstalling manual pages from $(DESTDIR)$(MANPREFIX)/man1
	@for i in $(MAN); do rm -f $(DESTDIR)$(MANPREFIX)/man1/$$i; done

.PHONY: all clean dist install uninstall test