summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/rltiles/makefile.mgw
blob: 040110d4e767ed3318603a96babe22c9bc020ba1 (plain) (blame)
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
##########################################################################
# makefile.mgw
#
# This is a makefile to build all the rltiles files needed for Dungeon
# Crawl - Stone Soup.
#
# - Enne (enne.walker@gmail.com)
#

SRC = tool
B2PSRC = bmp2png
B2P = bmp2png.exe
B2PTOOL = $(B2PSRC)\$(B2P)

CC = mingw32-gcc
DELETE = del
MAKE = mingw32-make.exe

OBJECTS = \
$(SRC)\bm.o \
$(SRC)\dcpl.o \
$(SRC)\dctile.o

TOOLS = \
dcpl.exe \
dctile.exe

EXTRATOOLS = \
dcreverse.exe

HEADERS = \
tiledef.h \
tiledef-p.h \
tilep-cmt.h \
tiledef-w2d.h \
tilecount-w2d.h \
map.htm

ALLTOOLS = $(TOOLS) $(EXTRATOOLS)

GENERATEDBMP = \
tile.bmp \
player.bmp \
wall2d.bmp

TILEBMP = \
$(GENERATEDBMP) \
title.bmp

TILEPNG = $(TILEBMP:.bmp=.png)

##########################################################################
# Top-level
#

all: tools tiles

tools: $(TOOLS)

tiles: $(TILEBMP)

##########################################################################
# Tools
#
# Note: dcreverse is not built by default.  It does the opposite
# of dctile.  It takes a bitmap with lots of tiles, specifies regions,
# and cuts them out into smaller pieces.  It's useful only for when somebody
# updates the tiles directly and then doesn't give you the source files.
#

depend: $(OBJECTS:.o=.c)
	@for i in $^; do \
		$(CC) -c $$i

dcpl.exe: $(SRC)\dcpl.o $(SRC)\bm.o
	$(CC) $(SRC)\dcpl.o $(SRC)\bm.o -o dcpl

dctile.exe: $(SRC)\dctile.o $(SRC)\bm.o
	$(CC) $(SRC)\dctile.o $(SRC)\bm.o -o dctile

dcreverse.exe: $(SRC)\dcreverse.o $(SRC)\bm.o
	$(CC) $(SRC)\dcreverse.o $(SRC)\bm.o -o dcreverse

##########################################################################
# Bitmaps
#

# NOTE: the dependencies here aren't fantastic.  In an ideal world,
# there would be another tool elf that could read an input text file
# and then output the .bmp and .txt dependencies for it.  It's kind
# of a low priority though, as tiles will be rebuilt infrequently.

tile.bmp: dc-2d.txt dctile.exe
	./dctile dc-2d.txt

player.bmp: dc-pl.txt dcpl.exe
	./dcpl dc-pl.txt

wall2d.bmp: dc-wall2d.txt dctile.exe
	./dctile dc-wall2d.txt

##########################################################################
# PNG Conversion
#

$(B2PTOOL):
	pushd $(B2PSRC) && $(MAKE) -f makefile.mgw $(B2P) && popd

%.png: %.bmp $(B2PTOOL)
	$(DELETE) $@
	$(B2PTOOL) -Q $<

##########################################################################
# Cleaning...
#

clean:
	$(DELETE) $(OBJECTS)
	$(DELETE) $(ALLTOOLS)
#pushd $(B2PSRC) && $(MAKE) -f makefile.mgw clean && popd

distclean: clean
	$(DELETE) $(GENERATEDBMP)
	$(DELETE) $(TILEPNG)
	$(DELETE) $(HEADERS)