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