-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
158 lines (136 loc) · 4.93 KB
/
Makefile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
CC = gcc
MAKE = make
LDFLAGS = -lncurses
OBJFILES = main.o draw.o erwin.o network.o scores.o
PREFIX = /usr/local
LOCALEPATH = /usr/local/share/locale
CFLAGS = -Wall -O2 -DPREFIX="\"$(PREFIX)\""
VERSION = `grep " VERSION" version.h | sed s/\"//g | sed s/\#define\ VERSION\ //`
LOCALES = de
MAN = doc/man
DISTDIR = tornado-$(VERSION)
### ###
### You shouldn't need to edit anything beyond this point ###
### ###
include Makefile.distfiles
all: tornado tornado.6 locales
locales:
$(MAKE) -C po all
tornado.6:
$(MAKE) -C $(MAN) all
tornado: $(OBJFILES)
$(CC) $(LDFLAGS) $(OBJFILES) -o tornado
debug: tornado.6 locales
gcc -g -ggdb -Wall -ansi -pedantic -o tornado draw.c main.c erwin.c network.c scores.c -lncurses -DPREFIX="\"$(PREFIX)\"" -DLOCALEPATH="\"$(LOCALEPATH)\""
static: tornado.6 locales
gcc -s -O2 -Wall -static -o tornado draw.c main.c erwin.c network.c scores.c -lncurses -DPREFIX="\"$(PREFIX)\"" -DLOCALEPATH="\"$(LOCALEPATH)\""
new: clean tornado tornado.6 locales
clean:
rm -f tornado *.o
rm -f tornado-$(VERSION).tar.gz
$(MAKE) -C po clean
$(MAKE) -C $(MAN) clean
install: tornado tornado.6 install-locale-data
@echo "Installing tornado binary in $(PREFIX)/bin..."
if [ ! -d "$(PREFIX)/bin" ]; then \
mkdir -p $(PREFIX)/bin; \
fi
install -s tornado $(PREFIX)/bin
$(MAKE) -C $(MAN) install-man
if [ -f "/var/games/tornado.scores" ]; then \
echo "Skipping install of the highscores file. File exists."; \
cat /var/games/tornado.scores | ./convert-highscorefile > score.tmp; \
mv -f score.tmp /var/games/tornado.scores; \
chmod a+rw-x "/var/games/tornado.scores"; \
else \
if [ ! -d "/var/games" ]; then \
mkdir /var/games; \
fi; \
install tornado.scores /var/games; \
chmod a+w-x "/var/games/tornado.scores"; \
fi
install-locale-data:
$(MAKE) -C po install-locale-data
uninstall:
rm -f $(PREFIX)/bin/tornado
rm -f /var/games/tornado.scores
$(MAKE) -C $(MAN) uninstall
$(MAKE) -C po uninstall
tornado-no-locales: tornado tornado.6
tornado-no-locales-install: tornado tornado.6
if [ ! -d "$(PREFIX)/bin" ]; then \
mkdir -p $(PREFIX)/bin; \
fi
install -s tornado $(PREFIX)/bin
if [ ! -d "$(PREFIX)/man/man6" ]; then \
mkdir -p $(PREFIX)/man/man6; \
fi
install -m 0644 tornado.6 $(PREFIX)/man/man6
if [ -f "/var/games/tornado.scores" ]; then \
echo "Skipping install of the highscores file. File exists."; \
cat /var/games/tornado.scores | ./convert-highscorefile > score.tmp; \
mv -f score.tmp /var/games/tornado.scores; \
chmod a+rw-x "/var/games/tornado.scores"; \
else \
if [ ! -d "/var/games" ]; then \
mkdir /var/games; \
fi; \
install tornado.scores /var/games; \
chmod a+w-x "/var/games/tornado.scores"; \
fi
dist: clean
mkdir $(DISTDIR)
cp -R $(DISTFILES) $(DISTDIR)
tar -czf $(DISTDIR).tar.gz $(DISTDIR)
rm -rf $(DISTDIR)
dist-binary: clean static
mkdir $(DISTDIR)
mkdir $(DISTDIR)/man
mkdir $(DISTDIR)/man/de
mkdir $(DISTDIR)/man/fr
mkdir $(DISTDIR)/man/it
mkdir $(DISTDIR)/man/nl
mkdir $(DISTDIR)/man/no
mkdir $(DISTDIR)/man/ru
mkdir $(DISTDIR)/po
cp AUTHOR COPYING CREDITS Changelog README INSTALL.binary TODO tornado tornado.scores $(DISTDIR)
cp doc/man/de/tornado.6 $(DISTDIR)/man/de
cp doc/man/fr/tornado.6 $(DISTDIR)/man/fr
cp doc/man/it/tornado.6 $(DISTDIR)/man/it
cp doc/man/nl/tornado.6 $(DISTDIR)/man/nl
cp doc/man/no/tornado.6 $(DISTDIR)/man/no
cp doc/man/ru/tornado.6 $(DISTDIR)/man/ru
cp doc/man/tornado.6 $(DISTDIR)/man
cp po/*.mo $(DISTDIR)/po
cp scripts/install.sh $(DISTDIR)
tar -czf $(DISTDIR).i386.tar.gz $(DISTDIR)
rm -rf $(DISTDIR)
dist-binary-ppc: clean tornado tornado.6
mkdir $(DISTDIR)
cp $(BINARYDISTFILES) $(DISTDIR)
tar -czf $(DISTDIR).ppc-darwin.tar.gz $(DISTDIR)
rm -rf $(DISTDIR)
dist-slack: clean tornado tornado.6 locales
mkdir -p $(DISTDIR)/usr/bin
mkdir -p $(DISTDIR)/usr/share/locale/de/LC_MESSAGES
mkdir -p $(DISTDIR)/usr/share/locale/fr/LC_MESSAGES
mkdir -p $(DISTDIR)/usr/share/locale/es/LC_MESSAGES
mkdir -p $(DISTDIR)/usr/share/locale/pt/LC_MESSAGES
mkdir -p $(DISTDIR)/usr/share/locale/it/LC_MESSAGES
mkdir -p $(DISTDIR)/usr/man/man6
mkdir -p $(DISTDIR)/usr/man/de/man6
mkdir -p $(DISTDIR)/usr/man/fr/man6
mkdir -p $(DISTDIR)/usr/doc/$(DISTDIR)
mkdir -p $(DISTDIR)/install
cp tornado $(DISTDIR)/usr/bin
cp po/de.mo $(DISTDIR)/usr/share/locale/de/LC_MESSAGES
cp po/fr.mo $(DISTDIR)/usr/share/locale/fr/LC_MESSAGES
cp po/es.mo $(DISTDIR)/usr/share/locale/es/LC_MESSAGES
cp po/pt.mo $(DISTDIR)/usr/share/locale/pt/LC_MESSAGES
cp po/it.mo $(DISTDIR)/usr/share/locale/it/LC_MESSAGES
cp doc/man/tornado.6 $(DISTDIR)/usr/man/man6
cp doc/man/de/tornado.6 $(DISTDIR)/usr/man/de/man6
cp doc/man/fr/tornado.6 $(DISTDIR)/usr/man/fr/man6
cp AUTHOR COPYING CREDITS Changelog README TODO $(DISTDIR)/usr/doc/$(DISTDIR)
cp scripts/slack-desc $(DISTDIR)/install
( cd $(DISTDIR) ; tar -czf ../$(DISTDIR)-i386-1.tgz usr install )