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