aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-02-17 13:06:02 +0100
committerJohn Ankarström <john@ankarstrom.se>2022-02-17 13:06:02 +0100
commit812d23eeb24c2b4502e338770df36072c5b1fa53 (patch)
tree6dc0b4650541ed334a5700753b2daf110f648793 /Makefile
parent447648c9db10167e5da4f0b431d7cfb878c5f807 (diff)
downloadEpisodeBrowser-812d23eeb24c2b4502e338770df36072c5b1fa53.tar.gz
Improve Makefile.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 18 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 1a52d46..6f1eb72 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,34 @@
-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
+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 -lgdi32 -luxtheme
+LDFLAGS += -lcomctl32 -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
+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)
+episode_browser.exe: $(C) $(OBJ) $(PL) $(ROOT)c/defs.h $(ROOT)Makefile
+ $(CC) -v $(CFLAGS) $(LDFLAGS) -goal true -o $@ $(C) $(OBJ) $(PL)
-resource.obj: $(PROJECT_ROOT)c/resource.h $(PROJECT_ROOT)c/resource.rc
- windres -i $(PROJECT_ROOT)c/resource.rc -o resource.obj
+resource.obj: $(ROOT)c/resource.h $(ROOT)c/resource.rc
+ windres -i $(ROOT)c/resource.rc -o resource.obj
-#%.o: $(PROJECT_ROOT)%.c
-# $(CC) -c $(CFLAGS) -o $@ $<
+%.obj: $(ROOT)c/%.c $(ROOT)c/defs.h
+ $(CC) -c $(CFLAGS) -o $@ $<
clean:
- rm -fr episode_browser.exe resource.obj $(EXTRA_CLEAN)
+ rm -fr episode_browser.exe *.obj