[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.9

1.9     ! niklas      1: #      $OpenBSD: bsd.lkm.mk,v 1.8 1996/08/01 10:17:53 niklas 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)
                     15: CFLAGS+=       ${COPTS} -D_KERNEL -I${BSDSRCDIR}/sys -I${BSDSRCDIR}/sys/arch
                     16: .else
1.1       mickey     17: CFLAGS+=       ${COPTS} -D_KERNEL -I/sys -I/sys/arch
1.8       niklas     18: .endif
1.1       mickey     19:
                     20: LDFLAGS+= -r
                     21: .if defined(LKM)
                     22: SRCS?= ${LKM}.c
                     23: .if !empty(SRCS:N*.h:N*.sh)
                     24: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
                     25: LOBJS+=        ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                     26: .endif
                     27: COMBINED?=combined.o
1.3       mickey     28: .if !defined(POSTINSTALL)
                     29: POSTINSTALL= ${LKM}install
                     30: .endif
1.1       mickey     31:
                     32: .if defined(OBJS) && !empty(OBJS)
                     33:
                     34: ${COMBINED}: ${OBJS} ${DPADD}
                     35:        ${LD} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
                     36:
                     37: .endif # defined(OBJS) && !empty(OBJS)
                     38:
                     39: .if    !defined(MAN)
                     40: MAN=   ${LKM}.1
                     41: .endif # !defined(MAN)
                     42: .endif # defined(LKM)
                     43:
                     44: .MAIN: all
                     45: all: ${COMBINED} _SUBDIRUSE
                     46:
                     47: .if !target(clean)
                     48: clean: _SUBDIRUSE
                     49:        rm -f a.out [Ee]rrs mklog core *.core \
                     50:            ${LKM} ${COMBINED} ${OBJS} ${LOBJS} ${CLEANFILES}
                     51: .endif
                     52:
                     53: cleandir: _SUBDIRUSE clean
                     54:
                     55: .if !target(install)
                     56: .if !target(beforeinstall)
                     57: beforeinstall:
                     58: .endif
                     59: .if !target(afterinstall)
                     60: afterinstall:
                     61: .endif
                     62:
                     63: .if !target(realinstall)
                     64: realinstall:
                     65: .if defined(LKM)
1.6       tholo      66:        install ${COPY} -o ${LKMOWN} -g ${LKMGRP} -m ${LKMMODE} \
1.2       tholo      67:            ${COMBINED} ${DESTDIR}${LKMDIR}/${LKM}.o
1.7       mickey     68: .if exists(${.CURDIR}/${POSTINSTALL})
                     69:        install -c -o ${LKMOWN} -g ${LKMGRP} -m 555 ${.CURDIR}/${POSTINSTALL} \
                     70:            ${DESTDIR}${LKMDIR}
                     71: .endif
1.1       mickey     72: .endif
                     73: .endif
                     74:
                     75:
                     76: load:  ${COMBINED}
1.3       mickey     77:        if [ -x ${.CURDIR}/${POSTINSTALL} ]; then \
                     78:                modload -d -o $(LKM) -e$(LKM) -p${.CURDIR}/${POSTINSTALL} $(COMBINED); \
                     79:        else \
                     80:                modload -d -o $(LKM) -e$(LKM) $(COMBINED); \
                     81:        fi
1.1       mickey     82:
                     83: unload:
                     84:        modunload -n $(LKM)
                     85:
                     86: install: maninstall _SUBDIRUSE
                     87: .if defined(LINKS) && !empty(LINKS)
                     88:        @set ${LINKS}; \
                     89:        while test $$# -ge 2; do \
                     90:                l=${DESTDIR}$$1; \
                     91:                shift; \
                     92:                t=${DESTDIR}$$1; \
                     93:                shift; \
                     94:                echo $$t -\> $$l; \
                     95:                rm -f $$t; \
                     96:                ln $$l $$t; \
                     97:        done; true
                     98: .endif
                     99:
                    100: maninstall: afterinstall
                    101: afterinstall: realinstall
                    102: realinstall: beforeinstall
                    103: .endif
                    104:
                    105: .if !target(lint)
                    106: lint: ${LOBJS}
                    107: .if defined(LOBJS) && !empty(LOBJS)
                    108:        @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
                    109: .endif
                    110: .endif
                    111:
                    112: .if !defined(NOMAN)
                    113: .include <bsd.man.mk>
                    114: .endif
                    115:
                    116: .if !defined(NONLS)
                    117: .include <bsd.nls.mk>
                    118: .endif
                    119:
                    120: .include <bsd.obj.mk>
                    121: .include <bsd.dep.mk>
                    122: .include <bsd.subdir.mk>
                    123: .include <bsd.sys.mk>