Annotation of src/share/mk/bsd.lkm.mk, Revision 1.6
1.4 mickey 1: # $OpenBSD: bsd.lkm.mk,v 1.3 1996/03/05 11:12:45 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:
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.1 mickey 62: .endif
63: .endif
64:
65:
66: load: ${COMBINED}
1.3 mickey 67: if [ -x ${.CURDIR}/${POSTINSTALL} ]; then \
68: modload -d -o $(LKM) -e$(LKM) -p${.CURDIR}/${POSTINSTALL} $(COMBINED); \
69: else \
70: modload -d -o $(LKM) -e$(LKM) $(COMBINED); \
71: fi
1.1 mickey 72:
73: unload:
74: modunload -n $(LKM)
75:
76: install: maninstall _SUBDIRUSE
77: .if defined(LINKS) && !empty(LINKS)
78: @set ${LINKS}; \
79: while test $$# -ge 2; do \
80: l=${DESTDIR}$$1; \
81: shift; \
82: t=${DESTDIR}$$1; \
83: shift; \
84: echo $$t -\> $$l; \
85: rm -f $$t; \
86: ln $$l $$t; \
87: done; true
88: .endif
89:
90: maninstall: afterinstall
91: afterinstall: realinstall
92: realinstall: beforeinstall
93: .endif
94:
95: .if !target(lint)
96: lint: ${LOBJS}
97: .if defined(LOBJS) && !empty(LOBJS)
98: @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
99: .endif
100: .endif
101:
102: .if !defined(NOMAN)
103: .include <bsd.man.mk>
104: .endif
105:
106: .if !defined(NONLS)
107: .include <bsd.nls.mk>
108: .endif
109:
110: .include <bsd.obj.mk>
111: .include <bsd.dep.mk>
112: .include <bsd.subdir.mk>
113: .include <bsd.sys.mk>