`# $Id: Makefile.host,v 2.65 2012/09/28 18:28:44 ksb Exp $ # platform recipe for op, msrc 2008 version 'dnl changequote([,])dnl [Q=' O=` ]changequote(`,') `SHELL=/bin/sh PROG= op RUN_BIN=/usr/local/bin RUN_LIB=/usr/local/lib BIN= ${DESTDIR}${RUN_BIN} DOC= ${DESTDIR}/usr/local/man # Where is the config file installed? LIB= ${DESTDIR}${RUN_LIB} ACCESS_FILE=${RUN_LIB}/op/access.cf CC='ifelse( HOSTTYPE,`SUN5',`cc', HOSTTYPE,`HPUX9',`gcc', HOSTTYPE,`HPUX10',`gcc', HOSTTYPE,`HPUX11',`gcc', `gcc')` I=/usr/include S=/usr/include/sys L=/usr/include/local P= INCLUDE='ifelse( HOSTTYPE,`FREEBSD',`',`-I.')` #DEBUG=-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter DEBUG='ifelse( HOSTTYPE,`HPUX9',`', HOSTTYPE,`HPUX10',`', HOSTTYPE,`V386',`',`-g')` CDEFS= -DMULTI_CONFIG -DSENTINEL -D'HOSTTYPE` -DTEXT_HOSTTYPE=\"'HOSTTYPE`\" -DHOSTOS='HOSTOS` -DRUN_AS=\"${RUN_BIN}/${PROG}\" -DACCESS_FILE=\"${ACCESS_FILE}\" 'ifelse( HOSTTYPE,`LINUX',` -D_GNU_SOURCE', HOSTTYPE,`HPUX9',` -DVARARGS=0', HOSTTYPE,`HPUX10',` -DVARARGS')` CFLAGS= ${DEBUG} ${CDEFS} ${INCLUDE} HDR= machine.h SRC= MAN= op.man DEP= main.c'ifelse( HOSTTYPE,`SUN5',` scandir.c',`')` OBJ= main.o'ifelse( HOSTTYPE,`SUN5',` scandir.o',`')` GEN= ${DEP} lib.opts main.h OTHER= README TODO mac.c mac.m op.m op.html config.html refs.html \ jacket.pl showme.sh SOURCE= Makefile ${OTHER} ${MAN} ${HDR} ${SRC} all: ${PROG} lib.opts: main.o nm main.o | sed -n -e "s/.*pam_authenticate.*/-lpam/p" >$@ # We support MAC if the local library does. You could change "Compile" # to "Check" (on the cmd-line) to see if the kernel does too. --ksb MAC_CFG=Compile mac.opts: mac.c mac.m -if MK= mk -m${MAC_CFG} mac.c 2>/dev/null ; then echo mac.m ; fi >$@ rm -f mac ${PROG}:$P ${OBJ} lib.opts ${CC} ${CFLAGS} -o $@ ${OBJ}'ifelse( HOSTTYPE,`DARWIN',`` -Wl,-setuid_safe,-root_safe'', HOSTTYPE,`FREEBSD',` -lcrypt', HOSTTYPE,`NETBSD',` -lcrypt', HOSTTYPE,`SUN5',` -lsocket -lnsl', HOSTTYPE,`LINUX',` -lcrypt')` ${O}cat lib.opts${O} main.h: main.c main.c: op.m mac.opts mkcmd op.m ${O}cat mac.opts${O}'ifelse( HOSTTYPE,`FREEBSD',`',` util_fgetln.m')` -(cmp -s prog.c main.c || (mv prog.c main.c && echo main.c updated)) -(cmp -s prog.h main.h || (mv prog.h main.h && echo main.h updated)) rm -rf prog.[ch] scandir.c: explode -s scandir.c # We need an empty access.cf to run -V, the lib source will update it (ksb) ${LIB}/op/access.cf: install -c -o root -m 0400 /dev/null $@ clean: FRC rm -f Makefile.bak ${PROG} ${GEN} mac *.opts a.out xs.c x.c *.o core errs lint.out tags calls: main.c FRC calls -x -F REAtSlash/main.c -F SanityCheck/main.c -F AnyConfig/main.c -F PickPrimary/main.c main.c spelling: main.c rm -f x.c xs.c xstr main.c ${CC} ${CFLAGS} -c xs.c strings xs.o | spell | sort -u | fmt | less rm -f xs.[co] x.c # We never build pam.d because that kills logins to older FreeBSD hosts # that have a pam.conf file, the empty directory take precedence and # locks ever other pam-driven authentication out. Beware! --ksb PAM_DIR=${DESTDIR}/etc/pam.d ${PAM_DIR}/op: -if [ -e ${PAM_DIR}/sudo ] ; then \ ln -s sudo ${PAM_DIR}/op ;\ elif [ -e ${PAM_DIR}/su ] ; then \ ln -s su ${PAM_DIR}/op ;\ fi [ -e ${PAM_DIR}/op ] # Assumes ksb-install is available, we should copy "su" if avaliable XXX # or maybe "sudo". Use "make pam" to trigger this machine. PAM_CONF=${DESTDIR}/etc/pam.conf PAM_CLONE=login update-pam.conf: FRC if grep "^op[ ]" ${PAM_CONF} >/dev/null ; then \ echo "${PAM_CONF} OK" ;\ else\ ( cat ${PAM_CONF} ;\ echo "# op configuration copied from ${PAM_CLONE}" ;\ sed -ne ${Q}/dial_auth/d${Q} -e ${Q}s/^${PAM_CLONE}\([ ]\)/op\1/p${Q} <${PAM_CONF} ;\ ) |install -c - ${PAM_CONF} &&\ echo "${PAM_CONF} updated" ;\ fi pam: FRC if [ -d ${PAM_DIR} ] ; then \ make ${PAM_DIR}/op ;\ elif [ -f ${PAM_CONF} ] ; then \ make update-pam.conf ;\ else \ $${false:-false} "no pam configuration I understand" ;\ fi deinstall: ${MAN} ${DOC} FRC install -R ${BIN}/${PROG} mkcat -r${DOC} -D ${MAN} depend: ${HDR} ${SRC} ${DEP} FRC maketd ${CDEFS} ${INCLUDE} ${DEP} dirs: ${BIN} distrib: FRC distrib -c ${BIN}/${PROG} HOST install: all dirs ${LIB} ${LIB}/op ${LIB}/op/access.cf FRC install -cs -m 4711 -o root ${PROG} ${BIN}/${PROG} lint: ${HDR} ${SRC} FRC lint -h ${CDEFS} ${INCLUDE} ${SRC} mkcat: ${MAN} ${DOC} FRC mkcat -r${DOC} ${MAN} print: source FRC lpr -J"${PROG} source" ${SOURCE} source: ${SOURCE} spotless: clean rcsclean ${SOURCE} tags: ${HDR} ${SRC} ctags -t ${HDR} ${SRC} ${LIB} ${LIB}/op ${BIN}: install -dr $@ ${SOURCE}: co -q $@ FRC: # DO NOT DELETE THIS LINE - maketd DEPENDS ON IT mac.o: mac.c main.o: machine.h main.c main.h scandir.o: scandir.c machine.h # *** Do not add anything here - It will go away. *** 'dnl