diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-15 21:58:40 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-15 21:58:40 +0200 |
commit | 22f36885bc5e2227fc194d3b64745631054fb175 (patch) | |
tree | e5f330de0c539d21dee5c1edc37817da3568e78a | |
parent | e2dfdd7d07f54b464a4419dcf102662f1694d4b8 (diff) | |
download | EpisodeBrowser-22f36885bc5e2227fc194d3b64745631054fb175.tar.gz |
Add showdeps script.
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | showdeps | 28 |
2 files changed, 42 insertions, 7 deletions
@@ -7,8 +7,8 @@ CFLAGS += -Wall -Wpedantic -O -cc-options,-std=c++17 -ld-options,-mwindows CFLAGS += -DUNICODE -D_UNICODE LDFLAGS += -lcomctl32 -luxtheme -all: b/$(EXE) - cp $< "C:\Users\John\Desktop\Delat" +all: showdeps b/$(EXE) + cp b/$(EXE) "C:\Users\John\Desktop\Delat" clean: rm -fr b/$(EXE) b/*.obj @@ -16,10 +16,7 @@ clean: TAGS: c/*.cpp c/*.h pl/*.pl etags c/*.cpp c/*.h -lprolog pl/*.pl -deps.mk: c/*.cpp - perl makedeps - -b/$(EXE): Makefile deps.mk c/main.cpp $(OBJ) $(PL) +b/$(EXE): Makefile c/main.cpp $(OBJ) $(PL) $(CC) -v $(CFLAGS) $(LDFLAGS) -goal true -o $@ c/main.cpp $(OBJ) $(PL) b/resource.obj: c/resource.h c/resource.rc c/application.manifest @@ -28,6 +25,16 @@ b/resource.obj: c/resource.h c/resource.rc c/application.manifest b/%.obj: c/%.cpp $(CC) -c $(CFLAGS) -o $@ $< +# showdeps prints a short summary of which dependencies have changed, +# causing which targets to be rebuilt. It is run by the `all' target +# by default. +.PHONY: showdeps +showdeps: + @perl showdeps + # deps.mk includes additional, dynamically generated dependencies for -# b/*.obj and b/EpisodeBrowser.exe. +# b/*.obj and b/EpisodeBrowser.exe. Because it is included below, GNU +# make should build deps.mk automatically. +deps.mk: c/*.cpp + perl makedeps -include deps.mk diff --git a/showdeps b/showdeps new file mode 100644 index 0000000..f59aeca --- /dev/null +++ b/showdeps @@ -0,0 +1,28 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my @targets; +my @keys; +my %prereqs; + +$ENV{LANGUAGE} = "en_US"; +for (`make --debug=b -n`) { + next if not /Prerequisite `([^']+)' is newer than target `([^']+)'/; + + # Don't consider prerequisites that are targets. + unless ($ARGV[0] and $ARGV[0] eq '-a') { + push @targets, $2 if not grep { $_ eq $2 } @targets; + next if grep { $_ eq $1 } @targets; + } + + push @keys, $1 if not grep { $_ eq $1 } @keys; + push @{$prereqs{$1}}, $2 if not grep { $_ eq $2 } @{$prereqs{$1}}; +} + +if (@keys) { + print "---\n"; + print "$_ -> @{$prereqs{$_}}\n" for @keys; + print "---\n"; +} |