Debian Codegraph @

Makefile

raw
1 #
2 # Makefile
3 #
4 # Copyright 2007, 2008 Lancer-X/ASCEAI
5 # Copyright 2013, 2019 Sylvain Beucler
6 #
7 # This file is part of Meritous.
8 #
9 # Meritous is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # Meritous is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with Meritous. If not, see <http://www.gnu.org/licenses/>.
21 #
22
23 # Automake-style terminology
24 DESTDIR=
25 prefix=/usr/local
26 bindir=$(prefix)/bin
27 datarootdir=$(prefix)/share
28 datadir=$(datarootdir)
29 pkgdatadir=$(datadir)/meritous
30 localedir=$(datarootdir)/locale
31
32 # Tools
33 INSTALL=install
34 MKDIR_P=$(INSTALL) -d -m 00755
35 CP_R=cp -r --preserve=timestamps
36
37 # Compilations flags
38 CFLAGS ?= -O2 -g -Wall
39 #CFLAGS := $(CFLAGS) $(shell sdl-config --cflags) # only work for env
40 override CFLAGS += $(shell sdl-config --cflags) # work both env and cmdline
41 override CPPFLAGS += -MD -MP -DDATADIR='"$(pkgdatadir)"' -DLOCALEDIR='"$(localedir)"'
42 LDLIBS = -lSDL_mixer -lSDL_image $(shell sdl-config --libs) -lz -lm
43
44 all: meritous
45 .PHONY: all clean po/meritous.pot
46
47 OBJS = src/levelblit.o \
48 src/mapgen.o \
49 src/demon.o \
50 src/gamemap.o \
51 src/tiles.o \
52 src/save.o \
53 src/help.o \
54 src/audio.o \
55 src/boss.o \
56 src/ending.o \
57 src/i18n.o
58 DEPS = $(OBJS:.o=.d)
59 -include $(DEPS)
60
61 meritous: $(OBJS)
62 $(CC) $(CFLAGS) $(LDFLAGS) $+ $(LDLIBS) -o $@
63
64 po/meritous.pot:
65 cd po; intltool-update --pot --gettext-package=meritous
66
67 po/%.po: po/meritous.pot
68 cd po; intltool-update --dist --gettext-package=meritous $*
69
70 install: meritous
71 $(MKDIR_P) "$(DESTDIR)$(bindir)"
72 $(INSTALL) meritous "$(DESTDIR)$(bindir)"
73
74 $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
75 $(CP_R) dat/* "$(DESTDIR)$(pkgdatadir)/"
76
77 $(MKDIR_P) "$(DESTDIR)$(localedir)"
78 for i in $$(cd po/ && ls ??.po | sed 's/\.po$$//'); do \
79 $(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/"; \
80 msgfmt --statistics po/$$i.po -o "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/meritous.mo"; \
81 done
82
83 $(MKDIR_P) "$(DESTDIR)$(datarootdir)/applications"
84 $(MKDIR_P) "$(DESTDIR)$(datarootdir)/metainfo"
85 $(MKDIR_P) "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps"
86 $(MKDIR_P) "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps"
87 intltool-merge -d -u po/ share/applications/net.asceai.meritous.desktop.in "$(DESTDIR)$(datarootdir)/applications/net.asceai.meritous.desktop"
88 intltool-merge -x -u po/ share/metainfo/net.asceai.meritous.appdata.xml.in "$(DESTDIR)$(datarootdir)/metainfo/net.asceai.meritous.appdata.xml"
89 $(CP_R) share/icons/hicolor/256x256/apps/meritous.png "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/"
90 $(CP_R) share/icons/hicolor/scalable/apps/meritous.svg "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/"
91
92 $(MKDIR_P) "$(DESTDIR)$(datarootdir)/man/man6/"
93 $(CP_R) share/man/man6/meritous.6 "$(DESTDIR)$(datarootdir)/man/man6/"
94
95 uninstall:
96 rm -f "$(DESTDIR)$(bindir)/meritous"
97 rm -rf "$(DESTDIR)$(pkgdatadir)/a/"
98 rm -rf "$(DESTDIR)$(pkgdatadir)/d/"
99 rm -rf "$(DESTDIR)$(pkgdatadir)/i/"
100 rm -rf "$(DESTDIR)$(pkgdatadir)/m/"
101 for i in $$(cd po/ && ls ??.po | sed 's/\.po$$//'); do \
102 rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/meritous.mo"; \
103 done
104 rm -f "$(DESTDIR)$(datarootdir)/applications/net.asceai.meritous.desktop"
105 rm -f "$(DESTDIR)$(datarootdir)/metainfo/net.asceai.meritous.appdata.xml"
106 rm -f "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/meritous.png"
107 rm -f "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/meritous.svg"
108
109 rm -f "$(DESTDIR)$(datarootdir)/man/man6/meritous.6"
110
111 clean:
112 rm -f $(OBJS) $(DEPS) meritous po/*.mo