HAMMER - Add hammer dedup directive and support
[dragonfly.git] / share / mk / bsd.hostlib.mk
blob38de38f49c14a8e691dc27a50293d9ad6961aed7
1 # $DragonFly: src/share/mk/bsd.hostlib.mk,v 1.2 2007/08/25 15:22:30 corecode Exp $
3 .include <bsd.init.mk>
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
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}
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}
20 all: objwarn
22 .if defined(LIB) && !empty(LIB)
23 OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.no/g}
24 .for _PATCH in ${SRCS:T:N*.no_obj.patch:N*.h.patch:M*.patch}
25 .for _OBJ in ${_PATCH:R:R:S/$/.no/}
26 OBJS:= ${OBJS:N${_OBJ}} ${_OBJ}
27 .endfor
28 .endfor
29 .endif
31 .if defined(LIB) && !empty(LIB)
32 _LIBS= lib${LIB}.na
34 lib${LIB}.na: ${OBJS} ${STATICOBJS}
35 @${ECHO} building native static ${LIB} library
36 rm -f ${.TARGET}
37 ${NXAR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
38 ${NXRANLIB} ${.TARGET}
39 .endif
41 all: ${_LIBS}
43 afterdepend: all
45 .include <bsd.dep.mk>
47 .if !exists(${.OBJDIR}/${DEPENDFILE})
48 .if defined(LIB) && !empty(LIB)
49 ${OBJS} ${STATICOBJS}: ${SRCS:M*.h}
50 .endif
51 .endif
53 .if !target(clean)
54 clean:
55 .if defined(CLEANFILES) && !empty(CLEANFILES)
56 rm -f ${CLEANFILES}
57 .endif
58 .if defined(LIB) && !empty(LIB)
59 rm -f a.out ${OBJS} ${OBJS:S/$/.tmp/} ${STATICOBJS}
60 .endif
61 .if defined(_LIBS) && !empty(_LIBS)
62 rm -f ${_LIBS}
63 .endif
64 .if defined(CLEANDIRS) && !empty(CLEANDIRS)
65 rm -rf ${CLEANDIRS}
66 .endif
67 .endif
69 .include <bsd.obj.mk>
71 .include <bsd.sys.mk>