aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 1a52d46c1f24257da2b5381f44a4bfcff7c9f8d1 (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
PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

INPUTS = $(PROJECT_ROOT)c/main.c
INPUTS += $(PROJECT_ROOT)c/common.c
INPUTS += $(PROJECT_ROOT)c/listview.c
INPUTS += $(PROJECT_ROOT)c/episodelistview.c
INPUTS += $(PROJECT_ROOT)c/datalistview.c
INPUTS += resource.obj
INPUTS += $(PROJECT_ROOT)pl/track_episodes.pl
INPUTS += $(PROJECT_ROOT)pl/local_episodes.pl
INPUTS += $(PROJECT_ROOT)pl/episode_data.pl

CFLAGS += -DUNICODE -D_UNICODE
LDFLAGS += -lcomctl32 -lgdi32 -luxtheme

ifeq ($(BUILD_MODE),debug)
	CFLAGS += -g
else ifeq ($(BUILD_MODE),run)
	CFLAGS += -O2 -ld-options,-mwindows
else ifeq ($(BUILD_MODE),linuxtools)
	CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
	LDFLAGS += -pg -fprofile-arcs -ftest-coverage
	EXTRA_CLEAN += episode_browser.gcda episode_browser.gcno $(PROJECT_ROOT)gmon.out
	EXTRA_CMDS = rm -rf episode_browser.gcda
else
    $(error Build mode $(BUILD_MODE) not supported by this Makefile)
endif

all:	episode_browser.exe

episode_browser.exe: $(INPUTS) $(PROJECT_ROOT)c/defs.h $(PROJECT_ROOT)Makefile
	swipl-ld -v $(CFLAGS) $(LDFLAGS) -goal true -o $@ $(INPUTS)
	$(EXTRA_CMDS)

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

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

clean:
	rm -fr episode_browser.exe resource.obj $(EXTRA_CLEAN)