# $DragonFly: src/share/mk/bsd.hostprog.mk,v 1.6 2004/07/21 13:34:27 joerg Exp $ .include .SUFFIXES: .out .nx .no .c .cc .cpp .cxx .C .m .y .l .s .S .if defined(PROG_CXX) PROG= ${PROG_CXX} .endif .if !defined(SRCS) .if defined(PROG_CXX) SRCS= ${PROG}.cc .else SRCS= ${PROG}.c .endif .endif all: objwarn ${PROG}.nx .if defined(PROG) # If there are Objective C sources, link with Objective C libraries. .if ${SRCS:M*.m} != "" OBJCLIBS?= -lobjc LDADD+= ${OBJCLIBS} .endif OBJS+= ${SRCS:N*.h:N*.patch:R:S/$/.no/g} .for _PATCH in ${SRCS:T:N*.h.patch:M*.patch} .for _OBJ in ${_PATCH:R:R:S/$/.no/} OBJS:= ${OBJS:N${_OBJ}} ${_OBJ} .endfor .endfor ${PROG}.nx: ${OBJS} .if defined(PROG_CXX) ${NXCXX} ${NXCXXFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .else ${NXCC} ${NXCFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} .endif .endif CLEANFILES+= ${PROG}.nx ${OBJS} all: ${PROG}.nx # header files are often generated by .nx binaries. All .nx binaries must # be built in the depend stage so the related header files can be generated # _EXTRADEPEND: all echo ${PROG}.nx: ${LIBC} ${DPADD} >> ${DEPENDFILE} .if defined(PROG_CXX) echo ${PROG}.nx: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE} .endif .include .if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE}) ${OBJS}: ${SRCS:M*.h} .endif .include .include