[BACK]Return to bsd.lkm.mk CVS log [TXT][DIR] Up to [local] / src / share / mk

Annotation of src/share/mk/bsd.lkm.mk, Revision 1.20

1.20    ! espie       1: #      $OpenBSD: bsd.lkm.mk,v 1.19 2003/05/20 22:49:13 millert Exp $
1.1       mickey      2:
                      3: .if exists(${.CURDIR}/../Makefile.inc)
                      4: .include "${.CURDIR}/../Makefile.inc"
                      5: .endif
                      6:
                      7: .include <bsd.own.mk>
                      8:
                      9: .SUFFIXES: .out .o .c .cc .C .y .l .s .8 .7 .6 .5 .4 .3 .2 .1 .0
                     10:
1.9       niklas     11: # XXX In order to at least diminish the brokenness of trusting /sys to point
                     12: # to the tree we're actually belonging to we check BSDSRCDIR.  On multi-tree
                     13: # machines /sys isn't always a link to the correct tree.
1.8       niklas     14: .if defined(BSDSRCDIR)
1.15      assar      15: CFLAGS+=       ${COPTS} -D_KERNEL -D_LKM -I${BSDSRCDIR}/sys -I${BSDSRCDIR}/sys/arch
1.8       niklas     16: .else
1.15      assar      17: CFLAGS+=       ${COPTS} -D_KERNEL -D_LKM -I/sys -I/sys/arch
1.17      espie      18: .endif
                     19: .if ${WARNINGS:L} == "yes"
                     20: CFLAGS+=       ${CDIAGFLAGS}
1.8       niklas     21: .endif
1.1       mickey     22:
                     23: LDFLAGS+= -r
                     24: .if defined(LKM)
                     25: SRCS?= ${LKM}.c
                     26: .if !empty(SRCS:N*.h:N*.sh)
                     27: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
                     28: LOBJS+=        ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                     29: .endif
                     30: COMBINED?=combined.o
1.3       mickey     31: .if !defined(POSTINSTALL)
                     32: POSTINSTALL= ${LKM}install
                     33: .endif
1.1       mickey     34:
                     35: .if defined(OBJS) && !empty(OBJS)
                     36:
                     37: ${COMBINED}: ${OBJS} ${DPADD}
                     38:        ${LD} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
                     39:
                     40: .endif # defined(OBJS) && !empty(OBJS)
                     41:
                     42: .if    !defined(MAN)
                     43: MAN=   ${LKM}.1
                     44: .endif # !defined(MAN)
                     45: .endif # defined(LKM)
                     46:
                     47: .MAIN: all
                     48: all: ${COMBINED} _SUBDIRUSE
                     49:
                     50: .if !target(clean)
                     51: clean: _SUBDIRUSE
                     52:        rm -f a.out [Ee]rrs mklog core *.core \
                     53:            ${LKM} ${COMBINED} ${OBJS} ${LOBJS} ${CLEANFILES}
                     54: .endif
                     55:
                     56: cleandir: _SUBDIRUSE clean
                     57:
                     58: .if !target(install)
                     59: .if !target(beforeinstall)
                     60: beforeinstall:
                     61: .endif
                     62: .if !target(afterinstall)
                     63: afterinstall:
                     64: .endif
                     65:
                     66: .if !target(realinstall)
                     67: realinstall:
                     68: .if defined(LKM)
1.12      millert    69:        ${INSTALL} ${INSTALL_COPY} -o ${LKMOWN} -g ${LKMGRP} -m ${LKMMODE} \
1.2       tholo      70:            ${COMBINED} ${DESTDIR}${LKMDIR}/${LKM}.o
1.7       mickey     71: .if exists(${.CURDIR}/${POSTINSTALL})
1.12      millert    72:        ${INSTALL} ${INSTALL_COPY} -o ${LKMOWN} -g ${LKMGRP} -m 555 \
1.11      downsj     73:            ${.CURDIR}/${POSTINSTALL} ${DESTDIR}${LKMDIR}
1.7       mickey     74: .endif
1.1       mickey     75: .endif
1.20    ! espie      76: .if defined(LINKS) && !empty(LINKS)
        !            77: .  for lnk file in ${LINKS}
        !            78:        @l=${DESTDIR}${LKMDIR}${lnk}; \
        !            79:         t=${DESTDIR}${LKMDIR}${file}; \
        !            80:         echo $$t -\> $$l; \
        !            81:         rm -f $$t; ln $$l $$t
        !            82: .  endfor
        !            83: .endif
1.1       mickey     84: .endif
                     85:
                     86:
                     87: load:  ${COMBINED}
1.3       mickey     88:        if [ -x ${.CURDIR}/${POSTINSTALL} ]; then \
                     89:                modload -d -o $(LKM) -e$(LKM) -p${.CURDIR}/${POSTINSTALL} $(COMBINED); \
                     90:        else \
                     91:                modload -d -o $(LKM) -e$(LKM) $(COMBINED); \
                     92:        fi
1.1       mickey     93:
                     94: unload:
                     95:        modunload -n $(LKM)
                     96:
                     97: install: maninstall _SUBDIRUSE
                     98:
                     99: maninstall: afterinstall
                    100: afterinstall: realinstall
                    101: realinstall: beforeinstall
                    102: .endif
                    103:
                    104: .if !target(lint)
                    105: lint: ${LOBJS}
                    106: .if defined(LOBJS) && !empty(LOBJS)
                    107:        @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
                    108: .endif
                    109: .endif
                    110:
                    111: .if !defined(NOMAN)
                    112: .include <bsd.man.mk>
                    113: .endif
                    114:
                    115: .if !defined(NONLS)
                    116: .include <bsd.nls.mk>
                    117: .endif
                    118:
                    119: .include <bsd.obj.mk>
                    120: .include <bsd.dep.mk>
                    121: .include <bsd.subdir.mk>
                    122: .include <bsd.sys.mk>
1.16      espie     123:
                    124: .PHONY: load unload