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