Merge branch 'vendor/GCC50'
[dragonfly.git] / share / mk / bsd.hostlib.mk
1 # $DragonFly: src/share/mk/bsd.hostlib.mk,v 1.2 2007/08/25 15:22:30 corecode Exp $
2
3 .include <bsd.init.mk>
4
5 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
6 # .So used for PIC object files
7 .SUFFIXES:
8 .SUFFIXES: .out .no .c .cc .cpp .cxx .C .y .l
9
10 .c.no:
11         ${NXCC} ${_${.IMPSRC}_FLAGS} ${NXCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
12         @${NXLD} -o ${.TARGET}.tmp -x -r ${.TARGET}
13         @mv ${.TARGET}.tmp ${.TARGET}
14
15 .cc.no .C.no .cpp.no .cxx.no:
16         ${NXCXX} ${_${.IMPSRC}_FLAGS} ${NXCXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
17         @${NXLD} -o ${.TARGET}.tmp -x -r ${.TARGET}
18         @mv ${.TARGET}.tmp ${.TARGET}
19
20 all: objwarn
21
22 .if defined(LIB) && !empty(LIB)
23 . if !empty(SRCS)
24 OBJS+=  ${SRCS:N*.h:N*.patch:R:S/$/.no/g}
25 .  for _PATCH in ${SRCS:T:N*.no_obj.patch:N*.h.patch:M*.patch}
26 .   for _OBJ in ${_PATCH:R:R:S/$/.no/}
27 OBJS:=  ${OBJS:N${_OBJ}} ${_OBJ}
28 .   endfor
29 .  endfor
30 . endif
31 .endif
32
33 .if defined(LIB) && !empty(LIB)
34 _LIBS=          lib${LIB}.na
35
36 lib${LIB}.na: ${OBJS} ${STATICOBJS}
37         @${ECHO} building native static ${LIB} library
38         rm -f ${.TARGET}
39         ${NXAR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
40         ${NXRANLIB} ${.TARGET}
41 .endif
42
43 all: ${_LIBS}
44
45 afterdepend: all
46
47 .include <bsd.dep.mk>
48
49 .if !exists(${.OBJDIR}/${DEPENDFILE})
50 .if defined(LIB) && !empty(LIB)
51 ${OBJS} ${STATICOBJS}: ${SRCS:M*.h}
52 .endif
53 .endif
54
55 .if !target(clean)
56 clean:
57 .if defined(CLEANFILES) && !empty(CLEANFILES)
58         rm -f ${CLEANFILES}
59 .endif
60 .if defined(LIB) && !empty(LIB)
61         rm -f a.out ${OBJS} ${OBJS:S/$/.tmp/} ${STATICOBJS}
62 .endif
63 .if defined(_LIBS) && !empty(_LIBS)
64         rm -f ${_LIBS}
65 .endif
66 .if defined(CLEANDIRS) && !empty(CLEANDIRS)
67         rm -rf ${CLEANDIRS}
68 .endif
69 .endif
70
71 .include <bsd.obj.mk>
72
73 .include <bsd.sys.mk>
74