subst_header.py (829B)
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- 2 # vim: set filetype=python: 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distibuted with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 import sys 8 9 import buildconfig 10 from mozbuild.preprocessor import Preprocessor 11 12 13 def main(output, input_file, *defines): 14 pp = Preprocessor() 15 pp.context.update({ 16 "FFI_EXEC_TRAMPOLINE_TABLE": "0", 17 "HAVE_LONG_DOUBLE": "0", 18 "TARGET": buildconfig.substs["FFI_TARGET"], 19 "VERSION": "", 20 }) 21 for d in defines: 22 pp.context.update({d: "1"}) 23 pp.do_filter("substitution") 24 pp.setMarker(None) 25 pp.out = output 26 pp.do_include(input_file) 27 28 29 if __name__ == "__main__": 30 main(*sys.agv[1:])