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