make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / compiled-tools / Makefile
blobd4b83f6f585c76c670b21c3e5bf468fcfc556e84
2 TARGET_DIR = /usr/tool
3 LIBDIR = /usr/lib/tool
4 OLDINCLUDEDIR = /usr/include/tool
6 TOOLS = grandparentexe relpath mksock remove syncfs utmp usbreset \
7 chmod-cheap setgroups kill-rogue xidle logbtmp lastcsv wall \
8 loadenv setpgrp xdpys cdstatus
10 SPECIAL_COMPILE_TOOLS = logbtmp lastcsv chmod-cheap wall
11 SPECIAL_INSTALL_TOOLS = grandparentexe netbulk lastbcsv
13 NORMAL_COMPILE_TOOLS = $(filter-out $(SPECIAL_COMPILE_TOOLS),$(TOOLS))
15 NORMAL_TARGET_FILES = $(foreach tool,$(filter-out $(SPECIAL_INSTALL_TOOLS),$(TOOLS)),$(TARGET_DIR)/$(tool))
16 SPECIAL_TARGET_FILES = $(foreach tool,$(SPECIAL_INSTALL_TOOLS),$(TARGET_DIR)/$(tool))
17 POD_FILES = $(filter $(wildcard *.pod),$(foreach tool,$(TOOLS),$(tool).pod))
21 .PHONY: default
22 default:
23 $(error may be interested in: all install-all install-manpages)
24 .PHONY: all
25 all: $(TOOLS) netbulk lastbcsv
26 .PHONY: install-all
27 install-all: $(NORMAL_TARGET_FILES) $(SPECIAL_TARGET_FILES) install-manpages /sbin/rebootlogon
30 define install-tool-recipe
31 install $< $@
32 @echo remove $@ >> uninstall.sh
33 endef
35 define make-subdir-tool-recipe:
36 $(MAKE) -C $(dir $@) $(notdir $@)
37 endef
41 $(NORMAL_COMPILE_TOOLS): %: %.c
42 $(CC) $< $(CFLAGS) -o $@
45 $(NORMAL_TARGET_FILES): $(TARGET_DIR)/%: %
46 $(install-tool-recipe)
48 $(TARGET_DIR)/grandparentexe: grandparentexe
49 $(install-tool-recipe)
50 chmod g+s $@
52 $(TARGET_DIR)/netbulk: netbulk
53 $(install-tool-recipe)
54 setcap cap_setgid+ep $(TARGET_DIR)/netbulk
56 $(TARGET_DIR)/lastbcsv: $(TARGET_DIR)/lastcsv
57 ln -sfT lastcsv $@
58 @echo remove $@ >> uninstall.sh
60 $(TARGET_DIR)/kill-rogue: /usr/share/man/man1/kill-rogue.1.gz
62 /usr/share/man/man1/kill-rogue.1.gz:
63 cat ../doc/kill-rogue.1 | gzip > $@
64 @echo remove $@ >> uninstall.sh
67 netbulk: setgroups.c
68 $(CC) $< $(CFLAGS) -DONLY_ALLOWED_GID=$(shell getent group netbulk | cut -d: -f3) -o $@
70 rebootlogon: rebootlogon.c
71 gcc $< $(CFLAGS) -o $@
73 lastbcsv: lastcsv
74 ln -sfT lastcsv $@
76 xidle xdpys: override CFLAGS += -lX11 -lXss
78 loadenv: override CFLAGS += -I$(OLDINCLUDEDIR) -L$(LIBDIR) -larray -Wl,-rpath=$(LIBDIR)
82 logbtmp: logbtmp.d/logbtmp
83 install $< $@
84 logbtmp.d/logbtmp:
85 $(make-subdir-tool-recipe)
87 lastcsv: lastcsv.d/lastcsv
88 install $< $@
89 lastcsv.d/lastcsv:
90 $(make-subdir-tool-recipe)
92 chmod-cheap: coreutils/chmod-cheap
93 install $< $@
94 coreutils/chmod-cheap:
95 $(make-subdir-tool-recipe)
97 wall: wall.d/wall
98 install $< $@
99 wall.d/wall:
100 $(make-subdir-tool-recipe)
107 MANPAGE_SECTION = 1
108 COMPRESSOR = xz
109 COMPRESSOR_EXT = xz
110 MANPAGE_FILE_SUFFIX = .$(MANPAGE_SECTION).$(COMPRESSOR_EXT)
111 SYSTEM_MANPAGES_PATH = /usr/share/man/man$(MANPAGE_SECTION)
112 SPECIAL_MANPAGES = relpath
113 MANPAGE_FILES = $(foreach podfile,$(filter-out $(SPECIAL_MANPAGES),$(POD_FILES)),$(SYSTEM_MANPAGES_PATH)/$(basename $(podfile))$(MANPAGE_FILE_SUFFIX))
115 $(MANPAGE_FILES): $(SYSTEM_MANPAGES_PATH)/%$(MANPAGE_FILE_SUFFIX): %.pod
116 pod2man --name="$(basename $<)" --section $(MANPAGE_SECTION) --utf8 "$<" | $(COMPRESSOR) > "$@~" && mv "$@~" "$@"
117 @echo remove $@ >> uninstall.sh
119 $(SYSTEM_MANPAGES_PATH)/lastbcsv$(MANPAGE_FILE_SUFFIX): lastcsv.pod
120 ln -sfn lastcsv "$@"
121 @echo remove $@ >> uninstall.sh
123 $(SYSTEM_MANPAGES_PATH)/relpath.1tool.$(COMPRESSOR_EXT): relpath.pod
124 pod2man --name="$(basename $<)" --section $(MANPAGE_SECTION) --utf8 "$<" | $(COMPRESSOR) > "$@~" && mv "$@~" "$@"
125 @echo remove $@ >> uninstall.sh
127 install-manpages: $(MANPAGE_FILES) $(SYSTEM_MANPAGES_PATH)/lastbcsv$(MANPAGE_FILE_SUFFIX) $(SYSTEM_MANPAGES_PATH)/relpath.1tool.$(COMPRESSOR_EXT)
128 /etc/cron.daily/man-db
130 .PHONY: install-manpages
135 /sbin/rebootlogon: rebootlogon
136 install -o root -g root -m 4444 $< $@
137 setfacl -m u:reboot:r-x $@