tech-toolchain archive

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

${CPP} arguments



Hi

In <bsd.x11.mk> we use ${CPP} to process some X11 scripts and manpages. I
think Xorg is moving away from this for manpages at least but I don't know
if they have a policy about it.

Unfortunately, the command arguments are hardwired and although the PCC
front end does support gcc style long arguments (-traditional at least is
already catered for) the preprocessor just uses getopt(3) and I think may
be ugly to require long args for back-end software like this.

so, solutions include

- wait for Xorg to move away from CPP for this
  (perhaps with assistance :)

- patch below allows the current PCC preprocessor to be used
  (undef is not required; predefined symbols come from pcc front end)

- make it use "${CC} -E -traditional -undef -" instead
  (then I provide a patch for pcc front end to handle -undef)

- other?

regards,
iain

Index: bsd.x11.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.x11.mk,v
retrieving revision 1.94
diff -u -r1.94 bsd.x11.mk
--- bsd.x11.mk  12 Mar 2011 13:22:03 -0000      1.94
+++ bsd.x11.mk  27 Mar 2011 09:46:45 -0000
@@ -176,6 +176,11 @@
                        -Wl,-rpath,${X11USRLIBDIR} \
                        -L${DESTDIR}${X11USRLIBDIR}

+.if defined(HAVE_PCC) && ${USETOOLS_PCC:Uyes} == "yes"
+_X11CPPCMD=    ${CPP} -t
+.else
+_X11CPPCMD=    ${CPP} -undef -traditional
+.endif

 #
 # .cpp -> "" handling
@@ -189,7 +194,7 @@
 .cpp:
        ${_MKTARGET_CREATE}
        rm -f ${.TARGET}
-       ${CPP} -undef -traditional \
+       ${_X11CPPCMD} \
            ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \
            < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET}

@@ -413,7 +418,7 @@
 _X11MANTRANSFORMCMD=   ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC}

 .if ${X11MANCPP} != "no"
-_X11MANTRANSFORMCMD+=  | ${CPP} -undef -traditional
+_X11MANTRANSFORMCMD+=  | ${_X11CPPCMD}
 . for __def__ __value__ in ${_X11MANTRANSFORM}
 _X11MANTRANSFORMCMD+=  -D${__def__}=${__value__:C/%/ /gW}
 . endfor


Home | Main Index | Thread Index | Old Index