Annotation of src/share/mk/bsd.lkm.mk, Revision 1.2
1.2 ! tholo 1: # $OpenBSD: bsd.lkm.mk,v 1.1 1996/02/25 19:02:33 mickey Exp $
1.1 mickey 2: # @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
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
22:
23: .if defined(OBJS) && !empty(OBJS)
24:
25: ${COMBINED}: ${OBJS} ${DPADD}
26: ${LD} ${LDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
27:
28: .endif # defined(OBJS) && !empty(OBJS)
29:
30: .if !defined(MAN)
31: MAN= ${LKM}.1
32: .endif # !defined(MAN)
33: .endif # defined(LKM)
34:
35: .MAIN: all
36: all: ${COMBINED} _SUBDIRUSE
37:
38: .if !target(clean)
39: clean: _SUBDIRUSE
40: rm -f a.out [Ee]rrs mklog core *.core \
41: ${LKM} ${COMBINED} ${OBJS} ${LOBJS} ${CLEANFILES}
42: .endif
43:
44: cleandir: _SUBDIRUSE clean
45:
46: .if !target(install)
47: .if !target(beforeinstall)
48: beforeinstall:
49: .endif
50: .if !target(afterinstall)
51: afterinstall:
52: .endif
53:
54: .if !target(realinstall)
55: realinstall:
56: .if defined(LKM)
57: install ${COPY} ${STRIP} -o ${LKMOWN} -g ${LKMGRP} -m ${LKMMODE} \
1.2 ! tholo 58: ${COMBINED} ${DESTDIR}${LKMDIR}/${LKM}.o
1.1 mickey 59: .endif
60: .endif
61:
62:
63: load: ${COMBINED}
64: modload -d -o $(LKM) -e$(LKM) $(COMBINED)
65:
66: unload:
67: modunload -n $(LKM)
68:
69: install: maninstall _SUBDIRUSE
70: .if defined(LINKS) && !empty(LINKS)
71: @set ${LINKS}; \
72: while test $$# -ge 2; do \
73: l=${DESTDIR}$$1; \
74: shift; \
75: t=${DESTDIR}$$1; \
76: shift; \
77: echo $$t -\> $$l; \
78: rm -f $$t; \
79: ln $$l $$t; \
80: done; true
81: .endif
82:
83: maninstall: afterinstall
84: afterinstall: realinstall
85: realinstall: beforeinstall
86: .endif
87:
88: .if !target(lint)
89: lint: ${LOBJS}
90: .if defined(LOBJS) && !empty(LOBJS)
91: @${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
92: .endif
93: .endif
94:
95: .if !defined(NOMAN)
96: .include <bsd.man.mk>
97: .endif
98:
99: .if !defined(NONLS)
100: .include <bsd.nls.mk>
101: .endif
102:
103: .include <bsd.obj.mk>
104: .include <bsd.dep.mk>
105: .include <bsd.subdir.mk>
106: .include <bsd.sys.mk>