File: Makefile

package info (click to toggle)
meritous 1.5-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,928 kB
  • sloc: ansic: 8,346; makefile: 86; python: 63
file content (112 lines) | stat: -rw-r--r-- 3,926 bytes parent folder | download | duplicates (3)
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
#
#   Makefile
#
#   Copyright 2007, 2008 Lancer-X/ASCEAI
#   Copyright 2013, 2019 Sylvain Beucler
#
#   This file is part of Meritous.
#
#   Meritous is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   Meritous is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with Meritous.  If not, see <http://www.gnu.org/licenses/>.
#

# Automake-style terminology
DESTDIR=
prefix=/usr/local
bindir=$(prefix)/bin
datarootdir=$(prefix)/share
datadir=$(datarootdir)
pkgdatadir=$(datadir)/meritous
localedir=$(datarootdir)/locale

# Tools
INSTALL=install
MKDIR_P=$(INSTALL) -d -m 00755
CP_R=cp -r --preserve=timestamps

# Compilations flags
CFLAGS ?= -O2 -g -Wall
#CFLAGS := $(CFLAGS) $(shell sdl-config --cflags)  # only work for env
override CFLAGS += $(shell sdl-config --cflags)    # work both env and cmdline
override CPPFLAGS += -MD -MP -DDATADIR='"$(pkgdatadir)"' -DLOCALEDIR='"$(localedir)"'
LDLIBS = -lSDL_mixer -lSDL_image $(shell sdl-config --libs) -lz -lm

all: meritous
.PHONY: all clean po/meritous.pot

OBJS = 	src/levelblit.o \
	src/mapgen.o \
	src/demon.o \
	src/gamemap.o \
	src/tiles.o \
	src/save.o \
	src/help.o \
	src/audio.o \
	src/boss.o \
	src/ending.o \
	src/i18n.o
DEPS = $(OBJS:.o=.d)
-include $(DEPS)

meritous: $(OBJS)
	$(CC) $(CFLAGS) $(LDFLAGS) $+ $(LDLIBS) -o $@

po/meritous.pot:
	cd po; intltool-update --pot --gettext-package=meritous

po/%.po: po/meritous.pot
	cd po; intltool-update --dist --gettext-package=meritous $*

install: meritous
	$(MKDIR_P) "$(DESTDIR)$(bindir)"
	$(INSTALL) meritous "$(DESTDIR)$(bindir)"

	$(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
	$(CP_R) dat/* "$(DESTDIR)$(pkgdatadir)/"

	$(MKDIR_P) "$(DESTDIR)$(localedir)"
	for i in $$(cd po/ && ls ??.po | sed 's/\.po$$//'); do \
		$(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/"; \
		msgfmt --statistics po/$$i.po -o "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/meritous.mo"; \
	done

	$(MKDIR_P) "$(DESTDIR)$(datarootdir)/applications"
	$(MKDIR_P) "$(DESTDIR)$(datarootdir)/metainfo"
	$(MKDIR_P) "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps"
	$(MKDIR_P) "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps"
	intltool-merge -d -u po/ share/applications/net.asceai.meritous.desktop.in "$(DESTDIR)$(datarootdir)/applications/net.asceai.meritous.desktop"
	intltool-merge -x -u po/ share/metainfo/net.asceai.meritous.appdata.xml.in "$(DESTDIR)$(datarootdir)/metainfo/net.asceai.meritous.appdata.xml"
	$(CP_R) share/icons/hicolor/256x256/apps/meritous.png "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/"
	$(CP_R) share/icons/hicolor/scalable/apps/meritous.svg "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/"

	$(MKDIR_P) "$(DESTDIR)$(datarootdir)/man/man6/"
	$(CP_R) share/man/man6/meritous.6 "$(DESTDIR)$(datarootdir)/man/man6/"

uninstall:
	rm -f "$(DESTDIR)$(bindir)/meritous"
	rm -rf "$(DESTDIR)$(pkgdatadir)/a/"
	rm -rf "$(DESTDIR)$(pkgdatadir)/d/"
	rm -rf "$(DESTDIR)$(pkgdatadir)/i/"
	rm -rf "$(DESTDIR)$(pkgdatadir)/m/"
	for i in $$(cd po/ && ls ??.po | sed 's/\.po$$//'); do \
		rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/meritous.mo"; \
	done
	rm -f "$(DESTDIR)$(datarootdir)/applications/net.asceai.meritous.desktop"
	rm -f "$(DESTDIR)$(datarootdir)/metainfo/net.asceai.meritous.appdata.xml"
	rm -f "$(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/meritous.png"
	rm -f "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/meritous.svg"

	rm -f "$(DESTDIR)$(datarootdir)/man/man6/meritous.6"

clean:		
	rm -f $(OBJS) $(DEPS) meritous po/*.mo