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