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

1.25    ! deraadt     1: #      $OpenBSD: bsd.lkm.mk,v 1.24 2013/03/14 12:56:58 mikeb 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:
1.21      mikeb      23: .if ${MACHINE} == "amd64"
                     24: CFLAGS+=       -mcmodel=kernel
                     25: .endif
1.24      mikeb      26:
                     27: CFLAGS+=       ${NOPIE_FLAGS}
                     28: AFLAGS+=       ${NOPIE_FLAGS}
                     29: LDFLAGS+=      ${NOPIE_LDFLAGS}
1.21      mikeb      30:
1.1       mickey     31: LDFLAGS+= -r
                     32: .if defined(LKM)
                     33: SRCS?= ${LKM}.c
                     34: .if !empty(SRCS:N*.h:N*.sh)
1.22      guenther   35: OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/}
1.1       mickey     36: .endif
                     37: COMBINED?=combined.o
1.3       mickey     38: .if !defined(POSTINSTALL)
                     39: POSTINSTALL= ${LKM}install
                     40: .endif
1.1       mickey     41:
                     42: .if defined(OBJS) && !empty(OBJS)
                     43:
                     44: ${COMBINED}: ${OBJS} ${DPADD}
                     45:        ${LD} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
                     46:
                     47: .endif # defined(OBJS) && !empty(OBJS)
                     48:
                     49: .if    !defined(MAN)
                     50: MAN=   ${LKM}.1
                     51: .endif # !defined(MAN)
                     52: .endif # defined(LKM)
                     53:
                     54: .MAIN: all
                     55: all: ${COMBINED} _SUBDIRUSE
                     56:
                     57: .if !target(clean)
                     58: clean: _SUBDIRUSE
1.25    ! deraadt    59:        rm -f a.out [Ee]rrs mklog *.core \
1.23      jsg        60:            ${LKM} ${COMBINED} ${OBJS} ${CLEANFILES}
1.1       mickey     61: .endif
                     62:
                     63: cleandir: _SUBDIRUSE clean
                     64:
                     65: .if !target(install)
                     66: .if !target(beforeinstall)
                     67: beforeinstall:
                     68: .endif
                     69: .if !target(afterinstall)
                     70: afterinstall:
                     71: .endif
                     72:
                     73: .if !target(realinstall)
                     74: realinstall:
                     75: .if defined(LKM)
1.12      millert    76:        ${INSTALL} ${INSTALL_COPY} -o ${LKMOWN} -g ${LKMGRP} -m ${LKMMODE} \
1.2       tholo      77:            ${COMBINED} ${DESTDIR}${LKMDIR}/${LKM}.o
1.7       mickey     78: .if exists(${.CURDIR}/${POSTINSTALL})
1.12      millert    79:        ${INSTALL} ${INSTALL_COPY} -o ${LKMOWN} -g ${LKMGRP} -m 555 \
1.11      downsj     80:            ${.CURDIR}/${POSTINSTALL} ${DESTDIR}${LKMDIR}
1.7       mickey     81: .endif
1.1       mickey     82: .endif
1.20      espie      83: .if defined(LINKS) && !empty(LINKS)
                     84: .  for lnk file in ${LINKS}
                     85:        @l=${DESTDIR}${LKMDIR}${lnk}; \
                     86:         t=${DESTDIR}${LKMDIR}${file}; \
                     87:         echo $$t -\> $$l; \
                     88:         rm -f $$t; ln $$l $$t
                     89: .  endfor
                     90: .endif
1.1       mickey     91: .endif
                     92:
                     93:
                     94: load:  ${COMBINED}
1.3       mickey     95:        if [ -x ${.CURDIR}/${POSTINSTALL} ]; then \
1.21      mikeb      96:                modload -d -o ${LKM} -e${LKM}_lkmentry \
                     97:                    -p${.CURDIR}/${POSTINSTALL} ${COMBINED}; \
1.3       mickey     98:        else \
1.21      mikeb      99:                modload -d -o ${LKM} -e${LKM}_lkmentry ${COMBINED}; \
1.3       mickey    100:        fi
1.1       mickey    101:
                    102: unload:
1.21      mikeb     103:        modunload -n ${LKM}
1.1       mickey    104:
                    105: install: maninstall _SUBDIRUSE
                    106:
                    107: maninstall: afterinstall
                    108: afterinstall: realinstall
                    109: realinstall: beforeinstall
                    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>
1.16      espie     124:
                    125: .PHONY: load unload