1 # $NetBSD: bsd.lib.mk,v 1.299 2009/11/27 11:44:36 tsutsui Exp $
2 # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
4 .
include <minix.init.mk
>
6 # Pull in <minix.sys.mk> here so we can override its .c.o rule
7 .
include <minix.sys.mk
>
13 realinstall
: libinstall
17 ##### LIB specific flags.
18 COPTS
+= ${COPTS.lib
${LIB}}
19 CPPFLAGS
+= ${CPPFLAGS.lib
${LIB}}
20 CXXFLAGS
+= ${CXXFLAGS.lib
${LIB}}
21 OBJCOPTS
+= ${OBJCOPTS.lib
${LIB}}
22 LDADD
+= ${LDADD.lib
${LIB}}
23 LDFLAGS
+= ${LDFLAGS.lib
${LIB}}
24 LDSTATIC
+= ${LDSTATIC.lib
${LIB}}
26 ##### Libraries that this may depend upon.
27 .if defined
(LIBDPLIBS
) && ${MKPIC} != "no" # {
28 .for _lib _dir in
${LIBDPLIBS}
29 .if
!defined
(LIBDO.
${_lib})
30 LIBDO.
${_lib}!= cd
${_dir} && ${PRINTOBJDIR}
31 .MAKEOVERRIDES
+=LIBDO.
${_lib}
33 LDADD
+= -L
${LIBDO.
${_lib}} -l
${_lib}
34 DPADD
+= ${LIBDO.
${_lib}}/lib
${_lib}.so
38 ##### Build and install rules
39 MKDEP_SUFFIXES?
= .o .po .so .go .ln
41 # add additional suffixes not exported.
42 # .po is used for profiling object files.
43 # .so is used for PIC object files.
44 .SUFFIXES
: .out .a .ln .so .po .go .o .s .S .c .
cc .
cpp .
cxx .C .m .F .f .r .y .l .cl .p .h
47 OBJCFLAGS
+= ${OBJCOPTS}
53 ${COMPILE.c
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
54 # .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
55 # ${OBJCOPY} -x ${.TARGET}
58 .
cc.o .
cpp.o .
cxx.o .C.o
:
60 ${COMPILE.
cc} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
61 # .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
62 # ${OBJCOPY} -x ${.TARGET}
67 ${COMPILE.s
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
68 # ${OBJCOPY} -x ${.TARGET}
72 ${COMPILE.S
} ${COPTS.
${.IMPSRC
:T
}} ${CPUFLAGS.
${.IMPSRC
:T
}} ${CPPFLAGS.
${.IMPSRC
:T
}} ${.IMPSRC
} -o
${.TARGET
}
73 # ${OBJCOPY} -x ${.TARGET}
80 OBJS
+=${SRCS
:N
*.h
:N
*.sh
:R
:S
/$/.o
/g
}
84 LOBJS
+=${LSRCS
:.c
=.ln
} ${SRCS
:M
*.c
:.c
=.ln
}
86 .if
${LIBISPRIVATE} != "no"
87 # No installation is required
89 .
endif # ${LIBISPRIVATE} == "no" # {
95 _YLSRCS
= ${SRCS
:M
*.
[ly
]:C
/\..
$/.c
/} ${YHEADER
:D
${SRCS
:M
*.y
:.y
=.h
}}
97 .NOPATH
: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
99 realall
: ${SRCS} ${ALLOBJS
:O
} ${_LIBS}
110 # ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
111 ${AR} ${_ARFL} ${.TARGET
} ${.ALLSRC
:M
*o
}
113 __archiveinstall
: .USE
115 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
116 ${_INSTRANLIB} ${.ALLSRC
} ${.TARGET
}
119 CLEANFILES
+= ${_YLSRCS}
121 ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
123 lib
${LIB}.a
:: ${STOBJS} __archivebuild
126 rm -f a.out
[Ee
]rrs mklog core
*.core
${CLEANFILES}
127 rm -f lib
${LIB}.a
${STOBJS}
129 .if
!target
(libinstall
) # {
131 libinstall
:: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
132 .PRECIOUS
: ${DESTDIR}${LIBDIR}/lib
${LIB}.a
134 ${INSTALL_FILE} -o
${LIBOWN} -g
${LIBGRP} -m
${LIBMODE} \
135 ${.ALLSRC
} ${.TARGET
}
137 .if
!defined
(BUILD
) && !make
(all) && !make
(lib
${LIB}.a
)
138 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: .MADE
140 ${DESTDIR}${LIBDIR}/lib
${LIB}.a
: lib
${LIB}.a __archiveinstall
142 .
endif # !target(libinstall) # }
144 ##### Pull in related .mk logic
147 LINKSMODE?
= ${LIBMODE}
148 .
include <minix.files.mk
>
149 .
include <minix.inc.mk
>
150 .
include <minix.links.mk
>
151 .
include <minix.dep.mk
>
153 .if
${COMPILER_TYPE} == "ack"
154 .
include <minix.ack.mk
>
155 .elif
${COMPILER_TYPE} == "gnu"
156 .
include <minix.gcc.mk
>