tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

MKREPRO=yes with different source locations



Hi all,
attached patch uses our -iremap option for CPP to avoid leaking the
location of DESTDIR or NETBSDSRCDIR into the binaries due to __FILE__.
This cuts down the list of files that change when moving src or objdir
to a bit over 50.

Joerg
Index: src/share/mk/bsd.hostprog.mk
===================================================================
--- src/share/mk/bsd.hostprog.mk
+++ src/share/mk/bsd.hostprog.mk
@@ -123,11 +123,11 @@
        rm -f a.out [Ee]rrs mklog core *.core \
            ${HOSTPROG} ${OBJS} ${LOBJS} ${CLEANFILES}
 
 beforedepend:
 CFLAGS:=       ${HOST_CFLAGS}
-CPPFLAGS:=     ${HOST_CPPFLAGS}
+CPPFLAGS:=     ${HOST_CPPFLAGS:N-Wp,-iremap,*}
 
 lint: ${LOBJS}
 .if defined(LOBJS) && !empty(LOBJS)
        ${LINT} ${LINTFLAGS} ${LDFLAGS:C/-L[  ]*/-L/Wg:M-L*} ${LOBJS} ${LDADD}
 .endif

Index: src/share/mk/bsd.sys.mk
===================================================================
--- src/share/mk/bsd.sys.mk
+++ src/share/mk/bsd.sys.mk
@@ -2,10 +2,15 @@
 #
 # Build definitions used for NetBSD source tree builds.
 
 .if !defined(_BSD_SYS_MK_)
 _BSD_SYS_MK_=1
+
+.if ${MKREPRO:Uno} == "yes"
+CPPFLAGS+=     -Wp,-iremap,${NETBSDSRCDIR}:/usr/src
+CPPFLAGS+=     -Wp,-iremap,${DESTDIR}/:/
+.endif
 
 .if defined(WARNS)
 .if ${WARNS} > 0
 CFLAGS+=       -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
 #CFLAGS+=      -Wmissing-declarations -Wredundant-decls -Wnested-externs

Index: src/tools/Makefile.host
===================================================================
--- src/tools/Makefile.host
+++ src/tools/Makefile.host
@@ -40,10 +40,11 @@
 .endif
 
 HOSTPROGNAME?= ${HOSTPROG}
 HOST_BINDIR?=  ${TOOLDIR}/bin
 HOST_CPPFLAGS:=        ${HOST_CPPFLAGS} ${CPPFLAGS}
+HOST_CPPFLAGS:=        ${HOST_CPPFLAGS:N-Wp,-iremap,*}
 .undef LINKS
 
 SRCS?=         ${HOSTPROG}.c
 SRCS+=         ${HOST_SRCS}
 



Home | Main Index | Thread Index | Old Index