~ubuntu-branches/ubuntu/karmic/pmake/karmic

« back to all changes in this revision

Viewing changes to mk/bsd.kmod.mk

  • Committer: Bazaar Package Importer
  • Author(s): Steve McIntyre
  • Date: 2002-03-12 21:59:55 UTC
  • Revision ID: james.westby@ubuntu.com-20020312215955-i183oxj3rpm464yh
Tags: 1.45-10
* Fixed broken '.Nm ""' directives in the man page. Closes: #137768
* Changed name from "make" to "pmake" in manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#       $NetBSD: bsd.kmod.mk,v 1.30 1999/03/10 06:34:19 ross Exp $
 
2
 
 
3
.if !target(__initialized__)
 
4
__initialized__:
 
5
.if exists(${.CURDIR}/../Makefile.inc)
 
6
.include "${.CURDIR}/../Makefile.inc"
 
7
.endif
 
8
.include <bsd.own.mk>
 
9
.include <bsd.obj.mk>
 
10
.MAIN:          all
 
11
.endif
 
12
 
 
13
.PHONY:         cleankmod kmodinstall load unload
 
14
realinstall:    kmodinstall
 
15
clean cleandir distclean: cleankmod
 
16
 
 
17
S?=             /sys
 
18
KERN=           $S/kern
 
19
 
 
20
CFLAGS+=        ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch
 
21
 
 
22
DPSRCS+=        ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
 
23
CLEANFILES+=    ${DPSRCS}
 
24
.if defined(YHEADER)
 
25
CLEANFILES+=    ${SRCS:M*.y:.y=.h}
 
26
.endif
 
27
 
 
28
OBJS+=          ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
 
29
 
 
30
.if !defined(PROG)
 
31
PROG=   ${KMOD}.o
 
32
.endif
 
33
 
 
34
${PROG}: ${DPSRCS} ${OBJS} ${DPADD}
 
35
        ${LD} -r ${LDFLAGS} -o tmp.o ${OBJS}
 
36
        mv tmp.o ${.TARGET}
 
37
 
 
38
.if     !defined(MAN)
 
39
MAN=    ${KMOD}.4
 
40
.endif
 
41
 
 
42
all: machine-links ${PROG}
 
43
 
 
44
.PHONY: machine-links
 
45
beforedepend: machine-links
 
46
machine-links:
 
47
        -rm -f machine && \
 
48
            ln -s $S/arch/${MACHINE}/include machine
 
49
        -rm -f ${MACHINE_ARCH} && \
 
50
            ln -s $S/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH}
 
51
CLEANFILES+=machine ${MACHINE_ARCH}
 
52
 
 
53
cleankmod:
 
54
        rm -f a.out [Ee]rrs mklog core *.core \
 
55
                ${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
 
56
 
 
57
#
 
58
# define various install targets
 
59
#
 
60
.if !target(kmodinstall)
 
61
kmodinstall:: ${DESTDIR}${KMODDIR}/${PROG}
 
62
.if !defined(UPDATE)
 
63
.PHONY: ${DESTDIR}${KMODDIR}/${PROG}
 
64
.endif
 
65
.if !defined(BUILD)
 
66
${DESTDIR}${KMODDIR}/${PROG}: .MADE
 
67
.endif
 
68
 
 
69
.PRECIOUS: ${DESTDIR}${KMODDIR}/${PROG}
 
70
${DESTDIR}${KMODDIR}/${PROG}: ${PROG}
 
71
        ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -o ${KMODOWN} -g ${KMODGRP} \
 
72
                -m ${KMODMODE} ${.ALLSRC} ${.TARGET}
 
73
.endif
 
74
 
 
75
lint: ${LOBJS}
 
76
.if defined(LOBJS) && !empty(LOBJS)
 
77
        ${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
 
78
.endif
 
79
 
 
80
.if !target(load)
 
81
load:   ${PROG}
 
82
        /sbin/modload -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
 
83
.endif
 
84
 
 
85
.if !target(unload)
 
86
unload: ${PROG}
 
87
        /sbin/modunload -n ${KMOD}
 
88
.endif
 
89
 
 
90
.include <bsd.man.mk>
 
91
.include <bsd.links.mk>
 
92
.include <bsd.dep.mk>
 
93
.include <bsd.sys.mk>
 
94
 
 
95
.-include "machine/Makefile.inc"