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