Skip to content

Commit

Permalink
Track Make dependencies automatically (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
theosotr authored and nelhage committed Jan 2, 2020
1 parent 48d4cb9 commit a3e2dce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
reptyr
ptrace
*.o
*.d
/.vagrant/
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
override CFLAGS := -Wall -Werror -D_GNU_SOURCE -g $(CFLAGS)
override CFLAGS := -MD -Wall -Werror -D_GNU_SOURCE -g $(CFLAGS)
OBJS=reptyr.o reallocarray.o attach.o
DEPS=$(wildcard *.d platform/*/*.d)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OBJS += platform/linux/linux_ptrace.o platform/linux/linux.o
Expand Down Expand Up @@ -37,12 +38,8 @@ test/victim: test/victim.o
test/victim: override CFLAGS := $(VICTIM_CFLAGS)
test/victim: override LDFLAGS := $(VICTIM_LDFLAGS)

attach.o: reptyr.h ptrace.h
reptyr.o: reptyr.h reallocarray.h
ptrace.o: ptrace.h platform/platform.h $(wildcard platform/*/arch/*.h)

clean:
rm -f reptyr $(OBJS) test/victim.o test/victim
rm -f reptyr $(OBJS) test/victim.o test/victim $(DEPS)

BASHCOMPDIR ?= $(shell $(PKG_CONFIG) --variable=completionsdir bash-completion 2>/dev/null)

Expand All @@ -59,3 +56,6 @@ install: reptyr
install -m 644 reptyr.bash $(DESTDIR)$$bashcompdir/reptyr

.PHONY: PHONY

# Pull-in dependencies generated by -MD
-include $(OBJS:.o=.d)

0 comments on commit a3e2dce

Please sign in to comment.