michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: INSTALL_TARGETS += errorlist michael@0: errorlist_FILES := \ michael@0: ErrorListCDefines.h \ michael@0: ErrorListCxxDefines.h \ michael@0: $(NULL) michael@0: errorlist_DEST = $(DIST)/include michael@0: errorlist_TARGET := export michael@0: michael@0: include $(topsrcdir)/config/rules.mk michael@0: michael@0: ifdef MOZ_WIDGET_GTK michael@0: CXXFLAGS += $(TK_CFLAGS) michael@0: endif michael@0: michael@0: # We generate ErrorListCxxDefines.h from ErrorList.h using regex. The -n option michael@0: # suppresses printing the pattern space, and the p at the end prints it anyway, michael@0: # so we don't print lines that don't match the pattern to start with. michael@0: ErrorListCxxDefines.h: ErrorList.h Makefile michael@0: echo '// IWYU pragma: private, include "nsError.h"' > $@ michael@0: sed -n 's/.*ERROR(\([A-Z_0-9]*\).*/#define \1 nsresult::\1/p' < $< >> $@ michael@0: michael@0: ErrorListCDefines.h: ErrorList.h Makefile michael@0: sed 's/.*ERROR(\([A-Z_0-9]*\),\( *\)\(.*\))[^)]*/#define \1 \2((nsresult)(\3))/' < $< > $@ michael@0: michael@0: GARBAGE += \ michael@0: ErrorListCxxDefines.h \ michael@0: ErrorListCDefines.h \ michael@0: $(NULL)