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