aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 6f1eb7235317ffec870164780c731b50edee8d40 (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
ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

C = $(ROOT)c/main.c
OBJ != cd $(ROOT)c && ls *.c | grep -v main.c | sed 's/c$$/obj/'
OBJ += resource.obj
PL += $(ROOT)pl/track_episodes.pl
PL += $(ROOT)pl/local_episodes.pl
PL += $(ROOT)pl/episode_data.pl

CC = swipl-ld
CFLAGS += -DUNICODE -D_UNICODE
LDFLAGS += -lcomctl32 -luxtheme

ifeq ($(BUILD_MODE),debug)
	CFLAGS += -g
else ifeq ($(BUILD_MODE),run)
	CFLAGS += -O2 -ld-options,-mwindows
else
    $(error Build mode $(BUILD_MODE) not supported by this Makefile)
endif

all: episode_browser.exe

episode_browser.exe: $(C) $(OBJ) $(PL) $(ROOT)c/defs.h $(ROOT)Makefile
	$(CC) -v $(CFLAGS) $(LDFLAGS) -goal true -o $@ $(C) $(OBJ) $(PL)

resource.obj: $(ROOT)c/resource.h $(ROOT)c/resource.rc
	windres -i $(ROOT)c/resource.rc -o resource.obj

%.obj: $(ROOT)c/%.c $(ROOT)c/defs.h
	$(CC) -c $(CFLAGS) -o $@ $<

clean:
	rm -fr episode_browser.exe *.obj