OSDN Git Service

説明書を日本語訳
[starfighter-jp/starfighter-jp.git] / Makefile
1 CXXFLAGS ?= -O2 -Wall -g
2 CXXFLAGS += `pkg-config --cflags sdl2 SDL2_image SDL2_mixer`
3 LIBS = `pkg-config --libs sdl2 SDL2_image SDL2_mixer`
4 OBJS = alien.o audio.o bullet.o cargo.o collectable.o engine.o explosion.o game.o graphics.o init.o intermission.o loadSave.o messages.o misc.o missions.o player.o resources.o script.o ship.o shop.o Starfighter.o title.o weapons.o
5
6 VERSION = 1.4
7 PROG = starfighter
8 DOCS = docs/*
9 DATA = data gfx sound music
10 DATAFILES = data/* gfx/* sound/* music/*
11
12 PREFIX ?= /usr
13 BINDIR ?= $(PREFIX)/games/
14 DATADIR ?= $(PREFIX)/share/games/parallelrealities/
15 DOCDIR ?= $(PREFIX)/share/doc/$(PROG)/
16
17 # top-level rule to create the program.
18 ALL = $(PROG)
19
20 all: $(ALL)
21
22 # compiling other source files.
23 %.o: src/%.cpp src/*.h
24         $(CXX) $(CXXFLAGS) -c -DVERSION=\"$(VERSION)\" -DDATADIR=\"$(DATADIR)\" $<
25
26 # linking the program.
27 $(PROG): $(OBJS)
28         $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $(PROG) $(LIBS)
29
30 # cleaning everything that can be automatically recreated with "make".
31 clean:
32         $(RM) $(OBJS) $(ALL)
33
34 # install
35 install: $(ALL)
36         mkdir -p $(DESTDIR)$(BINDIR)
37         mkdir -p $(DESTDIR)$(DATADIR)
38         mkdir -p $(DESTDIR)$(DOCDIR)
39
40         install -m 755 $(PROG) $(DESTDIR)$(BINDIR)$(PROG)
41         cp -pr $(DATA) $(DESTDIR)$(DATADIR)
42         cp -p $(DOCS) $(DESTDIR)$(DOCDIR)
43
44 optimise:
45         advpng -z gfx/*.png
46         jpegoptim --strip-all gfx/*.jpg
47
48 dist:
49         rm -rf starfighter-$(VERSION)
50         mkdir starfighter-$(VERSION)
51         cp --parents -lt starfighter-$(VERSION) `git ls-files`
52         git log >starfighter-$(VERSION)/ChangeLog
53         tar czf starfighter-$(VERSION).tar.gz starfighter-$(VERSION)
54         rm -rf starfighter-$(VERSION)
55
56 .PHONY: all clean install optimise dist