Allow a NULL pointer as argument to usb_get_next_event(), and don't
[dragonfly.git] / share / mk / bsd.hostprog.mk
blob094b337fa30d970ec69bacaa8cb8b6c3d841127d
1 # $DragonFly: src/share/mk/bsd.hostprog.mk,v 1.8 2008/05/19 10:26:02 corecode Exp $
3 .include <bsd.init.mk>
5 .SUFFIXES: .out .nx .no .c .cc .cpp .cxx .C .m .y .l .s .S
7 .if defined(PROG_CXX)
8 PROG= ${PROG_CXX}
9 .endif
11 .if !defined(SRCS)
12 .if defined(PROG_CXX)
13 SRCS= ${PROG}.cc
14 .else
15 SRCS= ${PROG}.c
16 .endif
17 .endif
19 all: objwarn ${PROG}.nx
21 .if defined(PROG)
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
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
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
44 CLEANFILES+= ${PROG}.nx ${OBJS}
46 all: ${PROG}.nx
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
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
58 afterdepend: all
60 .include <bsd.dep.mk>
62 .if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE})
63 ${OBJS}: ${SRCS:M*.h}
64 .endif
66 .include <bsd.obj.mk>
68 .include <bsd.sys.mk>