11ab64890Smrg# -*- Makefile -*- 21ab64890Smrg# Rules for generating files using the C pre-processor 31ab64890Smrg# (Replaces CppFileTarget from Imake) 41ab64890Smrg 5e9628295SmrgC_SED = LC_CTYPE=C $(SED) 61ab64890Smrg 7e9fcaa8aSmrgSUFFIXES += .pre 81ab64890Smrg 91ab64890SmrgWCHAR32_FLAGS = -DWCHAR32=@WCHAR32@ 101ab64890Smrg 111ab64890SmrgCPP_FILES_FLAGS = $(WCHAR32_FLAGS) 121ab64890Smrg 131ab64890Smrg# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM 141ab64890Smrg# to cpp, because that trick does not work on all ANSI C preprocessors. 151ab64890Smrg# Delete line numbers from the cpp output (-P is not portable, I guess). 161ab64890Smrg# Allow XCOMM to be preceded by whitespace and provide a means of generating 171ab64890Smrg# output lines with trailing backslashes. 181ab64890Smrg# Allow XHASH to always be substituted, even in cases where XCOMM isn't. 191ab64890Smrg 20e9628295SmrgCPP_SED_MAGIC = $(C_SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ 21e9628295Smrg -e '/^\#line *[0-9][0-9]* *.*$$/d' \ 22e9628295Smrg -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ 23e9628295Smrg -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ 24e9628295Smrg -e '/^[ ]*XHASH/s/XHASH/\#/' \ 25e9628295Smrg -e 's,X11_LOCALEDATADIR,$(X11_LOCALEDATADIR),g' \ 26e9628295Smrg -e '/\@\@$$/s/\@\@$$/\\/' \ 27e9628295Smrg -e '/^$$/d' 281ab64890Smrg 291ab64890Smrg.pre: 30e9fcaa8aSmrg @$(MKDIR_P) $(@D) 31b4ee4795Smrg $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ 32