Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/share/mk/bsd.prog.mk,v rcsdiff: /ftp/cvs/cvsroot/src/share/mk/bsd.prog.mk,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.269.2.2 retrieving revision 1.297 diff -u -p -r1.269.2.2 -r1.297 --- src/share/mk/bsd.prog.mk 2012/04/17 00:05:50 1.269.2.2 +++ src/share/mk/bsd.prog.mk 2016/03/12 23:08:58 1.297 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prog.mk,v 1.269.2.2 2012/04/17 00:05:50 yamt Exp $ +# $NetBSD: bsd.prog.mk,v 1.297 2016/03/12 23:08:58 mrg Exp $ # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 .ifndef HOSTPROG @@ -33,47 +33,64 @@ CLEANFILES+=strings .c.o: ${CC} -E ${CPPFLAGS} ${CFLAGS} ${.IMPSRC} | xstr -c - @${CC} ${CPPFLAGS} ${CFLAGS} -c x.c -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif @rm -f x.c .cc.o .cpp.o .cxx.o .C.o: ${CXX} -E ${CPPFLAGS} ${CXXFLAGS} ${.IMPSRC} | xstr -c - @mv -f x.c x.cc @${CXX} ${CPPFLAGS} ${CXXFLAGS} -c x.cc -o ${.TARGET} +.if defined(CTFCONVERT) + ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} +.endif @rm -f x.cc .endif -.if defined(MKPIE) && (${MKPIE} != "no") +.if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE) CFLAGS+= ${PIE_CFLAGS} AFLAGS+= ${PIE_AFLAGS} LDFLAGS+= ${PIE_LDFLAGS} .endif CFLAGS+= ${COPTS} +.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) +CFLAGS+= -g +.endif OBJCFLAGS+= ${OBJCOPTS} -MKDEP_SUFFIXES?= .o .ln +MKDEP_SUFFIXES?= .o .ln .d # CTF preserve debug symbols -.if defined(MKDTRACE) && (${MKDTRACE} != "no") && (${CFLAGS:M-g} != "") +.if (${MKCTF:Uno} != "no") && (${CFLAGS:M-g} != "") CTFFLAGS+= -g CTFMFLAGS+= -g +.if defined(HAVE_GCC) +#CFLAGS+=-gdwarf-2 +.endif .endif # ELF platforms depend on crti.o, crtbegin.o, crtend.o, and crtn.o .ifndef LIBCRTBEGIN -LIBCRTBEGIN= ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGIN} +LIBCRTBEGIN= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o ${_GCC_CRTBEGIN} .MADE: ${LIBCRTBEGIN} .endif .ifndef LIBCRTEND -LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/crtn.o +LIBCRTEND= ${_GCC_CRTEND} ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crtn.o .MADE: ${LIBCRTEND} .endif _SHLINKER= ${SHLINKDIR}/ld.elf_so .ifndef LIBCRT0 -LIBCRT0= ${DESTDIR}/usr/lib/crt0.o +LIBCRT0= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crt0.o .MADE: ${LIBCRT0} .endif +.ifndef LIBCRTI +LIBCRTI= ${DESTDIR}/usr/lib/${MLIBDIR:D${MLIBDIR}/}crti.o +.MADE: ${LIBCRTI} +.endif + ##### Installed system library definitions # # E.g. @@ -95,7 +112,6 @@ LIBCRT0= ${DESTDIR}/usr/lib/crt0.o c_pic \ com_err \ compat \ - crt0 \ crypt \ crypto \ crypto_idea \ @@ -108,6 +124,7 @@ LIBCRT0= ${DESTDIR}/usr/lib/crt0.o edit \ event \ expat \ + execinfo \ fetch \ fl \ form \ @@ -260,6 +277,10 @@ LIB${_lib:tu}= ${DESTDIR}${X11USRLIBDIR} .endif .endfor +# Ugly one-offs +LIBX11_XCB= ${DESTDIR}${X11USRLIBDIR}/libX11-xcb.a +LIBXCB= ${DESTDIR}${X11USRLIBDIR}/libxcb.a + .if defined(RESCUEDIR) CPPFLAGS+= -DRESCUEDIR=\"${RESCUEDIR}\" .endif @@ -309,25 +330,36 @@ _CCLINK= ${CXX} ${_CCLINKFLAGS} .endif .if defined(RUMPPRG) +CPPFLAGS+= -D_KERNTYPES PROG= ${RUMPPRG} -.ifndef CRUNCHEDPROG +. ifndef CRUNCHEDPROG +. if (${MKRUMP} != "no") PROGS= ${RUMPPRG} rump.${RUMPPRG} -. if defined(SRCS) +. else +PROGS= ${RUMPPRG} +. endif +. if defined(SRCS) +. if (${MKRUMP} != "no") SRCS.rump.${PROG}:= ${SRCS} ${PROG}_rumpops.c ${RUMPSRCS} +. endif SRCS+= ${PROG}_hostops.c -. else +. else SRCS= ${PROG}.c ${PROG}_hostops.c +. if (${MKRUMP} != "no") SRCS.rump.${PROG}= ${PROG}.c ${PROG}_rumpops.c ${RUMPSRCS} -. endif +. endif +. endif +. if (${MKRUMP} != "no") DPSRCS+= ${PROG}_rumpops.c ${RUMPSRCS} LDADD.rump.${PROG}+= -lrumpclient DPADD.rump.${PROG}+= ${LIBRUMPCLIENT} MAN.rump.${PROG}= # defined but feeling empty _RUMPINSTALL.rump.${PROG}=# defined -.else # CRUNCHEDPROG +. endif +. else # CRUNCHEDPROG PROGS= ${PROG} CPPFLAGS+= -DCRUNCHOPS -.endif +. endif .endif .if defined(PROG) @@ -358,6 +390,23 @@ PROGS= ${PROG} . endif .endif +##### Libraries that this may depend upon. +.if defined(PROGDPLIBS) # { +.for _lib _dir in ${PROGDPLIBS} +.if !defined(BINDO.${_lib}) +PROGDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR} +.MAKEOVERRIDES+=PROGDO.${_lib} +.endif +LDADD+= -L${PROGDO.${_lib}} -l${_lib} +.if exists(${PROGDO.${_lib}}/lib${_lib}_pic.a) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}_pic.a +.elif exists(${PROGDO.${_lib}}/lib${_lib}.so) +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.so +.else +DPADD+= ${PROGDO.${_lib}}/lib${_lib}.a +.endif +.endfor +.endif # } # # Per-program definitions and targets. # @@ -385,7 +434,7 @@ _CCLINK.${_P}= ${CXX} ${_CCLINKFLAGS} BINDIR.${_P}?= ${BINDIR} PROGNAME.${_P}?= ${_P} -.if ${MKDEBUG} != "no" && !commands(${_P}) +.if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG) && !commands(${_P}) _PROGDEBUG.${_P}:= ${PROGNAME.${_P}}.debug .endif @@ -395,6 +444,7 @@ PAXCTL_FLAGS.${_P}?= ${PAXCTL_FLAGS} ##### PROG specific flags. +_DPADD.${_P}= ${DPADD} ${DPADD.${_P}} _LDADD.${_P}= ${LDADD} ${LDADD.${_P}} _LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}} _LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}} @@ -435,7 +485,8 @@ NODPSRCS+= ${f} .endif .endfor -${_P}: .gdbinit ${LIBCRT0} ${XOBJS.${_P}} ${SRCS.${_P}} ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${XOBJS.${_P}} ${SRCS.${_P}} \ + ${DPSRCS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${_DPADD.${_P}} ${_MKTARGET_LINK} .if defined(DESTDIR) ${_CCLINK.${_P}} -Wl,-nostdlib \ @@ -468,13 +519,13 @@ CLEANFILES+= ${_P}.d ${OBJS.${_P}} ${LOBJS.${_P}}: ${DPSRCS} -${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD} +${_P}: .gdbinit ${LIBCRT0} ${LIBCRTI} ${OBJS.${_P}} ${LIBC} ${LIBCRTBEGIN} \ + ${LIBCRTEND} ${_DPADD.${_P}} .if !commands(${_P}) ${_MKTARGET_LINK} ${_CCLINK.${_P}} \ ${_LDFLAGS.${_P}} ${_LDSTATIC.${_P}} -o ${.TARGET} \ - ${OBJS.${_P}} ${_LDADD.${_P}} \ - ${_PROGLDOPTS} + ${OBJS.${_P}} ${_PROGLDOPTS} ${_LDADD.${_P}} .if defined(CTFMERGE) ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${OBJS.${_P}} .endif @@ -487,9 +538,9 @@ ${_P}: .gdbinit ${LIBCRT0} ${OBJS.${_P}} .endif # !commands(${_P}) .endif # USE_COMBINE -${_P}.ro: ${OBJS.${_P}} ${DPADD} +${_P}.ro: ${OBJS.${_P}} ${_DPADD.${_P}} ${_MKTARGET_LINK} - ${CC} ${LDFLAGS} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}} + ${CC} ${LDFLAGS:N-Wl,-pie} -nostdlib -r -Wl,-dc -o ${.TARGET} ${OBJS.${_P}} .if defined(_PROGDEBUG.${_P}) ${_PROGDEBUG.${_P}}: ${_P}