-
Notifications
You must be signed in to change notification settings - Fork 216
/
Makefile
61 lines (51 loc) · 1.71 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
endif
ifeq ($(UNAME_S),FreeBSD)
OBJS += platform/freebsd/freebsd_ptrace.o platform/freebsd/freebsd.o
LDFLAGS += -lprocstat
endif
# Note that because of how Make works, this can be overridden from the
# command-line.
#
# e.g. install to /usr with `make PREFIX=/usr`
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man
PKG_CONFIG ?= pkg-config
PYTHON_CMD ?= python2
all: reptyr
reptyr: $(OBJS)
ifeq ($(DISABLE_TESTS),)
test: reptyr test/victim PHONY
$(PYTHON_CMD) test/basic.py
$(PYTHON_CMD) test/tty-steal.py
else
test: all
endif
VICTIM_CFLAGS ?= $(CFLAGS)
VICTIM_LDFLAGS ?= $(LDFLAGS)
test/victim: test/victim.o
test/victim: override CFLAGS := $(VICTIM_CFLAGS)
test/victim: override LDFLAGS := $(VICTIM_LDFLAGS)
clean:
rm -f reptyr $(OBJS) test/victim.o test/victim $(DEPS)
BASHCOMPDIR ?= $(shell $(PKG_CONFIG) --variable=completionsdir bash-completion 2>/dev/null)
install: reptyr
install -d -m 755 $(DESTDIR)$(BINDIR)
install -m 755 reptyr $(DESTDIR)$(BINDIR)/reptyr
install -d -m 755 $(DESTDIR)$(MANDIR)/man1
install -m 644 reptyr.1 $(DESTDIR)$(MANDIR)/man1/reptyr.1
install -d -m 755 $(DESTDIR)$(MANDIR)/fr/man1
install -m 644 reptyr.fr.1 $(DESTDIR)$(MANDIR)/fr/man1/reptyr.1
bashcompdir=$(BASHCOMPDIR) ; \
test -z "$$bashcompdir" && bashcompdir=/etc/bash_completion.d ; \
install -d -m 755 $(DESTDIR)$$bashcompdir ; \
install -m 644 reptyr.bash $(DESTDIR)$$bashcompdir/reptyr
.PHONY: PHONY
# Pull-in dependencies generated by -MD
-include $(OBJS:.o=.d)