aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
blob: e652839657f64b98ffc44a2d6eb89ff70211c26a (plain)
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
ifeq ($(LIBMIKMOD_BASE),)
$(error Set LIBMIKMOD_BASE variable to libmikmod base directory with the DOS library compiled)
endif

BIN	:= ../game.exe
CC	:= i586-pc-msdosdjgpp-gcc
CFLAGS	:= -I. -I$(LIBMIKMOD_BASE)/include -c -Wall -Werror -pedantic -O3 -fomit-frame-pointer -ffast-math -march=i386# -DDEBUG
LDFLAGS := -s -L$(LIBMIKMOD_BASE)/dos
LIBS	:= -lmikmod

IMGS		:= $(wildcard ../data/*.png)
IMG_OBJS 	:= $(IMGS:../data/%.png=%.o)

MAPS		:= $(wildcard ../data/*.json)
MAP_OBJS	:= $(MAPS:../data/%.json=%.o)

WAVS		:= $(wildcard ../data/*.wav)
WAV_OBJS 	:= $(WAVS:../data/%.wav=%.o)

SRCS	:= $(wildcard *.c)
OBJS	:= $(SRCS:.c=.o) $(IMG_OBJS) palette.o $(MAP_OBJS) $(WAV_OBJS) music.o

all: $(BIN)

$(BIN): $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)

.c.o:
	$(CC) $(CFLAGS) $< -o $@

palette.o: ../data/sprites.png
	../tools/pngpal.py $< $@

$(IMG_OBJS): %.o: ../data/%.png
	../tools/pngpix.py $< $@

# max-ents is MAX_ENTITY - 1 to account for the time monster
$(MAP_OBJS): %.o: ../data/%.json
	../tools/map.py --max-ents 19 $< $@

$(WAV_OBJS): %.o: ../data/%.wav
	../tools/raw.py $< $@

music.o: ../data/music.it
	../tools/raw.py $< $@

clean:
	rm -f $(BIN) *.o Makefile.deps

Makefile.deps: $(SRCS)
	$(CC) $(CFLAGS) -MM *.[ch] > Makefile.deps

.PHONY: all clean

include Makefile.deps