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:R:S/$/.no/g} 32 33${PROG}.nx: ${OBJS} 34.if defined(PROG_CXX) 35 ${NXCXX_LINK} ${NXCXXFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} 36.else 37 ${NXCC_LINK} ${NXCFLAGS} ${NXLDFLAGS} -o ${.TARGET} ${OBJS} ${LDADD} 38.endif 39.endif 40 41CLEANFILES+= ${PROG}.nx ${OBJS} 42 43all: ${PROG}.nx 44 45_EXTRADEPEND: 46 sed -i '' -Ee 's/^([^.]+)\.o:/\1.no:/' ${DEPENDFILE} 47 echo ${PROG}.nx: ${LIBC} ${DPADD} >> ${DEPENDFILE} 48.if defined(PROG_CXX) 49 echo ${PROG}.nx: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE} 50.endif 51 52# header files are often generated by .nx binaries. All .nx binaries must 53# be built in the depend stage so the related header files can be generated 54# 55afterdepend: all 56 57.include <bsd.dep.mk> 58 59.if defined(PROG) && !exists(${.OBJDIR}/${DEPENDFILE}) 60${OBJS}: ${SRCS:M*.h} 61.endif 62 63.include <bsd.obj.mk> 64 65.include <bsd.sys.mk> 66