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
))
23 $(error may be interested in
: all install-all install-manpages
)
25 all: $(TOOLS
) netbulk lastbcsv
27 install-all
: $(NORMAL_TARGET_FILES
) $(SPECIAL_TARGET_FILES
) install-manpages
/sbin
/rebootlogon
30 define install-tool-recipe
32 @echo remove
$@
>> uninstall.sh
35 define make-subdir-tool-recipe
:
36 $(MAKE
) -C
$(dir $@
) $(notdir $@
)
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
)
52 $(TARGET_DIR
)/netbulk
: netbulk
53 $(install-tool-recipe
)
54 setcap cap_setgid
+ep
$(TARGET_DIR
)/netbulk
56 $(TARGET_DIR
)/lastbcsv
: $(TARGET_DIR
)/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
68 $(CC
) $< $(CFLAGS
) -DONLY_ALLOWED_GID
=$(shell getent group netbulk | cut
-d
: -f3
) -o
$@
70 rebootlogon
: rebootlogon.c
71 gcc
$< $(CFLAGS
) -o
$@
76 xidle xdpys
: override CFLAGS
+= -lX11
-lXss
78 loadenv
: override CFLAGS
+= -I
$(OLDINCLUDEDIR
) -L
$(LIBDIR
) -larray
-Wl
,-rpath
=$(LIBDIR
)
82 logbtmp
: logbtmp.d
/logbtmp
85 $(make-subdir-tool-recipe
)
87 lastcsv
: lastcsv.d
/lastcsv
90 $(make-subdir-tool-recipe
)
92 chmod-cheap
: coreutils
/chmod-cheap
94 coreutils
/chmod-cheap
:
95 $(make-subdir-tool-recipe
)
100 $(make-subdir-tool-recipe
)
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
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
$@