xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/bundle/cpprules.in (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
2*4882a593Smuzhiyun# to cpp, because that trick does not work on all ANSI C preprocessors.
3*4882a593Smuzhiyun# Delete line numbers from the cpp output (-P is not portable, I guess).
4*4882a593Smuzhiyun# Allow XCOMM to be preceded by whitespace and provide a means of generating
5*4882a593Smuzhiyun# output lines with trailing backslashes.
6*4882a593Smuzhiyun# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunCPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
9*4882a593Smuzhiyun                       -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
10*4882a593Smuzhiyun                       -e '/^[ 	]*XCOMM$$/s/XCOMM/\#/' \
11*4882a593Smuzhiyun                       -e '/^[ 	]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
12*4882a593Smuzhiyun                       -e '/^[ 	]*XHASH/s/XHASH/\#/' \
13*4882a593Smuzhiyun                       -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
14*4882a593Smuzhiyun                       -e '/\@\@$$/s/\@\@$$/\\/'
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunSUFFIXES = .cpp
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.cpp:
19*4882a593Smuzhiyun	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
20