# Makefile for Idled # # C compiler flags CC = cc 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. 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. ###################################################################### ###################################################################### # 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 = /usr/sbin CFDEST = /etc MDEST = /usr/man LOGDEST = /var/log OWNER = root CFOWNER = root MOWNER = root GROUP = root CFGROUP = root 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.conf CFMAN = idled.conf.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} ${DESTDIR}${DEST} install -c -m ${CFMODE} -o ${CFOWNER} -g ${CFGROUP} ${COMMFILE}.template ${DESTDIR}${CFDEST} install -c -m ${MMODE} -o ${MOWNER} ${CFMAN} ${DESTDIR}${MDEST}/man5 install -c -m ${MMODE} -o ${MOWNER} ${PMAN} ${DESTDIR}${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 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. ***