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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
|
# Makefile for Idled
#
# C compiler flags
CC = gcc -O4 -s
RM = rm
INCLUDE =
######################################################################
#
# Definitions for different unices.
#
######################################################################
#
# If your system keeps track of processes using procfs
# (/proc), define HAVE_PROC_FS. This determines what
# method is used for checking to see if xlock is running.
# Note that the /proc directory on Linux is not the correct
# structure. The procfs that is necessary is for the entire
# contents of /proc to consist solely of files, probably with
# their names being the process id's of the current processes,
# and otherwise somehow coded.
#
# If you don't HAVE_PROC_FS, perhaps one of the other search
# methos for xlock_check will work. In that case, if you
# have KVM stuff (ie. <kvm.h> and lib kvm) define
# PROC_SEARCH_1.
#
# If zapping does not work, ie. the user does not get logged
# out, you can try the 'ps' hack by defining PS_HACK. The
# "/bin/ps" line in zap.c may need to be adjusted to get
# the proper parameters sent to ps for your system. The
# current setup should work fine for SunOS 4.x, perhaps others.
#
# Define UTMPPID if your utmp file contains the process id
# of the login shell for each entry.
# BSD does not have it.
#
# If you do not UTMPPID, then one of two other kill
# methods will be attempted. If your system has a good
# tcgetpgrp() function, then it will be used to get the
# pid of the shell. If you don't, the backup method
# will be tried. If you know yours doesn't work (ie.
# it always returns -1 when calling it on a different
# tty) then you can save a couple of bytes of executable
# space by defining BAD_PGRP.
#
# Define UTMPHOST if your utmp file contains a ut_host entry
# to specify where the user is logged in from. This is required
# to enable 'from host' killing.
#
# If your system has an extended utmp file with utmpx.h and
# either the ut_pid or ut_host fields are not present in
# the normal utmp file, then define HAVE_UTMPX to use the
# extended utmp file.
#
# If you have setsid(), then define HAVE_SETSID to allow
# total daemonizing of idled.
#
# If you know your system has yyrestart() for its 'yacc'-ed
# output, or the 'make' fails due to "duplicate symbol yyrestart"
# or a similar error, then define HAVE_YYRESTART.
#
# If you use XDM and want the X-Windows console to behave
# decently, define XDM_HACK. If idled kills the console
# user in XDM_HACK mode, it manually kills every tty owned
# by that user.
#
# If you wish to mail messages to the people who idled logs
# out, define MAILMESSAGE. Make sure you also specify the
# correct MAILPATH and MAILMESSAGEFILE paths, where MAILPATH
# is the path to the mail program to use, and MAILMESSAGEFILE
# is the generic file to send to the user. These last two are
# in idled.h.
#
# If you have problems with idled warning users but never logging them
# out, especiaally under DU 3.2, add -DDISABLE_WARNS to the defs line.
# This will prevent warns from happening, but logouts should work.
######################################################################
######################################################################
# BSD -- SunOS 4.x
# Note: If idled fails to log users off, try adding -DPS_HACK on the
# DEFS line to have idled use that killing method.
#DEFS += -DBSD4_2 -DUTMPHOST -DHAVE_SETSID -DPROC_SEARCH_1
#SPECLIBS = -lkvm
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# Older BSDI --- (See BSD/OS 2.0 for newer versions of BSDI)
# Define PROC_SEARCH_1 to enable xlock checking with the
# "kill user immediately if xlock found" effect
# If you add it, '-lkvm' must also be added to the SPECLIBS line
# You will need to delete parse.c before compiling! You can either
# do so by hand, or do a 'make clean' followed by the normal 'make'.
##DEFS += -DPROC_SEARCH_1
#DEFS += -DBSDI -DHAVE_SETSID
#SPECLIBS =
##SPECLIBS += -lkvm
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# BSD/OS 2.0 --- New BSDI
# You will need to delete parse.c before compiling! You can either
# do so by hand, or do a 'make clean' followed by the normal 'make'.
#DEFS += -DBSD_OS2 -DUTMPHOST -DPROC_SEARCH_1 -DHAVE_SETSID -DHAVE_YYRESTART -DPS_HACK
#SPECLIBS = -lkvm
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = man
#
#GROUP = daemon
#CFGROUP = daemon
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# FreeBSD-2.X
# Define PROC_SEARCH_1 to enable xlock checking with the
# "kill user immediately if xlock found" effect
# If you add it, '-lkvm' must also be added to the SPECLIBS line
# You will need to delete parse.c before compiling! You can either
# do so by hand, or do a 'make clean' followed by the normal 'make'.
#DEFS += -O -m486
#DEFS += -DBSD_OS2 -DHAVE_SETSID -DHAVE_YYRESTART -DPS_HACK
#DEFS += -DPROC_SEARCH_1
#SPECLIBS = -lkvm
#INSTTYPE = install1a
#
#DEST = /usr/local/libexec
#CFDEST = /usr/local/libexec
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = man
#
#GROUP = daemon
#CFGROUP = daemon
#
#MODE = 750
#CFMODE = 664
#MMODE = 444
######################################################################
######################################################################
# Ultrix 4.4
#DEFS = -DHAVE_SETSID -DUTMPHOST
#SPECLIBS =
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /usr/adm
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = system
#CFGROUP = system
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# SVR4 -- Solaris 2.x
# Use install3 for /usr/sbin/install
# and install1 for /usr/ucb/install
#DEFS += -DSYSV -DHAVE_PROC_FS -DUTMPPID -DHAVE_SETSID -DHAVE_UTMPX -DUTMPHOST -DRUDEKILL
#SPECLIBS =
#INSTTYPE = install3
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# Linux
# Note: NOT all version of Linux have yyrestart(). Remove the
# -DHAVE_YYRESTART if you have problems.
# You should do a 'make clean' before 'make', so that parse.c
# and scan.c will be created on your system.
DEFS += -DSYSV -DUTMPPID -DUTMPHOST -DHAVE_SETSID -DHAVE_YYRESTART
SPECLIBS =
INSTTYPE = install1
#
DEST = $(DESTDIR)/usr/sbin
CFDEST = $(DESTDIR)/etc
MDEST = $(DESTDIR)/usr/man
LOGDEST = $(DESTDIR)/var/log
#
OWNER = root
CFOWNER = root
MOWNER = root
#
GROUP = root
CFGROUP = root
#
MODE = 755
CFMODE = 644
MMODE = 644
######################################################################
######################################################################
# UnixWare 2.01 -- SVR4.2 MP (probably other UnixWare 2.x too)
#DEFS = -DSYSV -DUTMPPID -DHAVE_SETSID
#SPECLIBS =
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# UnixWare 1.1.4 -- SVR4.2 (probably other UnixWare 1.x too)
#DEFS = -DSYSV -DHAVE_PROC_FS -DUTMPPID -DHAVE_SETSID
#SPECLIBS =
#INSTTYPE = install3
#
#DEST = /opt/bin
#CFDEST = /opt/lib/idled
#MDEST = /opt/man
#LOGDEST = /usr/adm
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = sys
#CFGROUP = sys
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# AIX 3.2.5 (probably other AIX 3.x too)
#DEFS = -DSYSV -DAIX -DUTMPPID -DUTMPHOST -DHAVE_SETSID
#SPECLIBS =
#INSTTYPE = install2
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = system
#CFGROUP = system
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# Dec Alpha OSF/1 V3 and DIGITAL Unix
# If you have problems with idled warning users but never logging them
# out, especiaally under DU 3.2, add -DDISABLE_WARNS to the defs line.
# This will prevent warns from happening, but logouts should work.
#DEFS = -DSYSV -DHAVE_PROC_FS -DUTMPPID -DHAVE_SETSID -DUTMPHOST
#SPECLIBS =
#INSTTYPE = install3
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
# DIGITAL Unix wants system (does OSF/1?):
##GROUP = system
##CFGROUP = system
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# SVR3 -- Univel
#DEFS += -DHAVE_SETSID -DPROC_SEARCH_1
#SPECLIBS = -lkvm
#INSTTYPE = install1
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /var/log
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = root
#CFGROUP = root
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
# HP-UX 9.0X --- Also SGI's
#DEFS = -DHAVE_SETSID -DSYSV -DUTMPPID
#SPECLIBS =
#INSTTYPE = install3
#
#DEST = /usr/local/bin
#CFDEST = /usr/local/lib
#MDEST = /usr/local/man
#LOGDEST = /usr/adm
#
#OWNER = root
#CFOWNER = root
#MOWNER = root
#
#GROUP = sys
#CFGROUP = sys
#
#MODE = 750
#CFMODE = 664
#MMODE = 644
######################################################################
######################################################################
######################################################################
#
# Define DEBUG to have idled put more debug information in its logfile.
# It will not log anyone off when compiled in debug mode!
#DEBUG = -DDEBUG=1
# programs (not including paths) that need explicit make lines, plain files
BINARY = idled
COMMFILE= idled.cf
CFMAN = idled.cf.5
PMAN = idled.8
# Names of config and log files
CONFIG = ${CFDEST}/${COMMFILE}
LOGFILE = ${LOGDEST}/idled.log
# HERE are the big CFLAGS
# Add -g if you want debugging
# Add -O or whatever variant for optimization
CFLAGS = ${DEFS} ${DEBUG} -DCONFIG=\"${CONFIG}\" -DLOGFILE=\"${LOGFILE}\" ${INCLUDE}
# For HP's ANSI C compiler (use -g instead of +O3 for debugging)
# CFLAGS = +O3 -Aa -D_HPUX_SOURCE ${DEFS} ${DEBUG} -DCONFIG=\"${CONFIG}\" -DLOGFILE=\"${LOGFILE}\" ${INCLUDE}
LIBS = ${SPECLIBS}
#
#####################################################################
# Hopefully, you shouldn't have to change anything below this line.
#####################################################################
#
# Source files to be mkdepended
SRC = insque.c list.c idled.c warn.c xlock_check.c zap.c linetimelist.c
SRCl = parse.y scan.l
SRCg = parse.c scan.c
MAN = $(CFMAN) $(PMAN)
HDR = idled.h
OBJ = insque.o list.o parse.o scan.o idled.o warn.o xlock_check.o zap.o linetimelist.o
all: ${BINARY} ${MAN}
clean:
${RM} -f a.out ${OBJ} core errs lint.errs Makefile.bak *.s tags \
${SRCg} ${BINARY} y.tab.* lex.yy.c
#depend: ${SRC} ${SRCg} ${HDR}
# maketd -a ${DEFS} ${INCLUDE} ${SRC} ${SRCg}
# Some systems use install1, some use install2, others install3, others use ????
# Aix Prefers install2
# BSD machines in general prefer install1
# Solaris 2.x uses install1 for /usr/ucb/install
# and install3 for /usr/sbin/install (/etc/install is linked to it)
install: ${INSTTYPE}
# BSD machines in general prefer install1
# Solaris 2.x using /usr/ucb/install also uses install1
install1: all
install -c -m ${MODE} -o ${OWNER} -g ${GROUP} ${BINARY} ${DEST}
install -c -m ${CFMODE} -o ${CFOWNER} -g ${CFGROUP} ${COMMFILE}.template ${CFDEST}/${COMMFILE}
install -c -m ${MMODE} -o ${MOWNER} ${CFMAN} ${MDEST}/man5
install -c -m ${MMODE} -o ${MOWNER} ${PMAN} ${MDEST}/man8
@echo ""
@echo "Be sure to edit/create the file ${CONFIG} based on"
@echo "the needs for your system. The ${CONFIG}.template"
@echo "file can serve as a guide, as well as the man pages."
# BSD like, but with some enhancements like: install -s -> strip binary
# gzip manual pages
install1a: all
install -s -c -m ${MODE} -o ${OWNER} -g ${GROUP} ${BINARY} ${DEST}
install -c -m ${CFMODE} -o ${CFOWNER} -g ${CFGROUP} ${COMMFILE}.template ${CFDEST}
install -c -m ${MMODE} -o ${MOWNER} ${CFMAN} ${MDEST}/man5
gzip -f ${MDEST}/man5/${CFMAN}
install -c -m ${MMODE} -o ${MOWNER} ${PMAN} ${MDEST}/man8
gzip -f ${MDEST}/man8/${PMAN}
@echo ""
@echo "Be sure to edit/create the file ${CONFIG} based on"
@echo "the needs for your system. The ${CONFIG}.template"
@echo "file can serve as a guide, as well as the man pages."
# Aix Prefers install2
install2: all
install -c ${DEST} -M ${MODE} -O ${OWNER} -G ${GROUP} ${BINARY} ${DEST}
install -c ${CFDEST} -M ${CFMODE} -O ${CFOWNER} -G ${CFGROUP} ${COMMFILE}.template ${CFDEST}
install -c ${MDEST}/man5 -M ${MMODE} -O ${MOWNER} ${CFMAN} ${MDEST}/man5
install -c ${MDEST}/man8 -M ${MMODE} -O ${MOWNER} ${PMAN} ${MDEST}/man8
@echo ""
@echo "Be sure to edit/create the file ${CONFIG} based on"
@echo "the needs for your system. The ${CONFIG}.template"
@echo "file can serve as a guide, as well as the man pages."
# Solaris 2.x using /usr/sbin/install uses install3
# This install 'f'orces the files into the directory, but backs up the
# 'o'ld file to OLD<file> if a file in that name was already in that directory
install3: all
install -o -f ${DEST} -m ${MODE} -u ${OWNER} -g ${GROUP} ${BINARY}
install -o -f ${CFDEST} -m ${CFMODE} -u ${CFOWNER} -g ${CFGROUP} ${COMMFILE}.template
install -o -f ${MDEST}/man5 -m ${MMODE} -u ${MOWNER} ${CFMAN}
install -o -f ${MDEST}/man8 -m ${MMODE} -u ${MOWNER} ${PMAN}
@echo ""
@echo "Be sure to edit/create the file ${CONFIG} based on"
@echo "the needs for your system. The ${CONFIG}.template"
@echo "file can serve as a guide, as well as the man pages."
man: ${MAN}
${MAN}: idled.man.form idled.cf.man.form
echo ${CONFIG} | sed 's/\//\\\//g' > .maketmp
echo ${LOGFILE} | sed 's/\//\\\//g' > .maketmp2
sed -e "s/CONFIGPATH/`cat .maketmp`/" -e "s/LOGFILEPATH/`cat .maketmp2`/" idled.cf.man.form > ${CFMAN}
sed -e "s/CONFIGPATH/`cat .maketmp`/" -e "s/LOGFILEPATH/`cat .maketmp2`/" idled.man.form > ${PMAN}
rm -f .maketmp .maketmp2
lint: ${SRC} ${SRCg}
lint -hxn ${DEFS} ${SRC} ${SRCg}
print:
print -n -J "Idled Source" Makefile ${HDR} ${SRCl} ${SRC}
shar:
shar README Makefile ${COMMFILE} ${MAN} ${SRC} ${SRCl} ${HDR} > idled.shar
source: ${SRC} ${SRCl} ${HDR} ${MAN} ${COMMFILE}
spotless:
${RM} -f a.out ${OBJ} core errs lint.errs Makefile.bak y.tab.* yacc.act\
yacc.tmp *.s ${BINARY} tags parse.c scan.c
rcsclean ${SRC} ${SRCl} ${HDR} ${COMMFILE} ${MAN}
tags: ${SRCS} ${SRCg} tags
ctags ${SRC} ${SRCg}
# The utmp file lines counter. Useful, perhaps, in ensuring that
# MAXUSERS is set large enough in idled.h. MAXUSERS should be larger
# than the number of lines (the output number).
utmplines: utmplinesp
@./utmplinesp
utmplinesp: utmplines.c
@${CC} ${DEFS} -o utmplinesp utmplines.c
# rules for everybody in ${BINARY} go here
idled: ${OBJ}
${CC} ${CFLAGS} -o idled ${OBJ} ${LIBS}
y.tab.h: parse.c
parse.c: parse.y
yacc -d parse.y
mv y.tab.c parse.c
scan.c: scan.l
lex scan.l
mv lex.yy.c scan.c
# DO NOT DELETE THIS LINE - make depend DEPENDS ON IT
insque.o: insque.c
list.o: list.c idled.h y.tab.h
idled.o: idled.c idled.h
warn.o: warn.c idled.h
xlock_check.o: xlock_check.c idled.h
zap.o: zap.c idled.h
parse.o: parse.c idled.h
scan.o: scan.c y.tab.h
# *** Do not add anything here - It will go away. ***
|