Use off_t for file positions in comsat.
[dragonfly.git] / share / mk / bsd.hostprog.mk
1 # $DragonFly: src/share/mk/bsd.hostprog.mk,v 1.8 2008/05/19 10:26:02 corecode Exp $
2
3 .include <bsd.init.mk>
4
5 .SUFFIXES: .out .nx .no .c .cc .cpp .cxx .C .m .y .l .s .S
6
7 .if defined(PROG_CXX)
8 PROG=   ${PROG_CXX}
9 .endif
10
11 .if !defined(SRCS)
12 .if defined(PROG_CXX)
13 SRCS=   ${PROG}.cc
14 .else
15 SRCS=   ${PROG}.c
16 .endif
17 .endif
18
19 all: objwarn ${PROG}.nx
20
21 .if defined(PROG)
22
23 # If there are Objective C sources, link with Objective C libraries.
24 .if ${SRCS:M*.m} != ""
25 OBJCLIBS?= -lobjc
26 LDADD+= ${OBJCLIBS}
27 .endif
28
29 OBJS+=  ${SRCS:N*.h:N*.patch:R:S/$/.no/g}
30 .for _PATCH in ${SRCS:T:N*.h.patch:M*.patch}
31 .for _OBJ in ${_PATCH:R:R:S/$/.no/}
32 OBJS:=  ${OBJS:N${_OBJ}} ${_OBJ}
33 .endfor
34 .endfor
35
36 ${PROG}.nx: ${OBJS}
37 .if defined(PROG_CXX)
38         ${NXCXX_LINK} ${NXCXXFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
39 .else
40         ${NXCC_LINK} ${NXCFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD}
41 .endif
42 .endif
43
44 CLEANFILES+= ${PROG}.nx ${OBJS}
45
46 all: ${PROG}.nx
47
48 _EXTRADEPEND:
49         sed -i '' -Ee 's/^([^.]+)\.o:/\1.no:/' ${DEPENDFILE}
50         echo ${PROG}.nx: ${LIBC} ${DPADD} >> ${DEPENDFILE}
51 .if defined(PROG_CXX)
52         echo ${PROG}.nx: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
53 .endif
54
55 # header files are often generated by .nx binaries.  All .nx binaries must
56 # be built in the depend stage so the related header files can be generated
57 #
58 afterdepend: all
59
60 .include <bsd.dep.mk>
61
62 .if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
63 ${OBJS}: ${SRCS:M*.h}
64 .endif
65
66 .include <bsd.obj.mk>
67
68 .include <bsd.sys.mk>