1*8af74909SZhong Yang#!/usr/bin/env python3 2*8af74909SZhong Yang# DepGen.py - produce a make dependencies file for Scintilla 3*8af74909SZhong Yang# Copyright 2019 by Neil Hodgson <[email protected]> 4*8af74909SZhong Yang# The License.txt file describes the conditions under which this software may be distributed. 5*8af74909SZhong Yang# Requires Python 3.6 or later 6*8af74909SZhong Yang 7*8af74909SZhong Yangimport sys 8*8af74909SZhong Yang 9*8af74909SZhong Yangsys.path.append("..") 10*8af74909SZhong Yang 11*8af74909SZhong Yangfrom scripts import Dependencies 12*8af74909SZhong Yang 13*8af74909SZhong YangtopComment = "# Created by DepGen.py. To recreate, run DepGen.py.\n" 14*8af74909SZhong Yang 15*8af74909SZhong Yangdef Generate(): 16*8af74909SZhong Yang sources = ["../src/*.cxx", "../lexlib/*.cxx", "../lexers/*.cxx"] 17*8af74909SZhong Yang includes = ["../include", "../src", "../lexlib"] 18*8af74909SZhong Yang 19*8af74909SZhong Yang # Create the dependencies file for g++ 20*8af74909SZhong Yang deps = Dependencies.FindDependencies(["../win32/*.cxx"] + sources, ["../win32"] + includes, ".o", "../win32/") 21*8af74909SZhong Yang 22*8af74909SZhong Yang # Add ScintillaBaseL as the same as ScintillaBase 23*8af74909SZhong Yang deps = Dependencies.InsertSynonym(deps, "ScintillaBase.o", "ScintillaBaseL.o") 24*8af74909SZhong Yang 25*8af74909SZhong Yang # Add CatalogueL as the same as Catalogue 26*8af74909SZhong Yang deps = Dependencies.InsertSynonym(deps, "Catalogue.o", "CatalogueL.o") 27*8af74909SZhong Yang 28*8af74909SZhong Yang Dependencies.UpdateDependencies("../win32/deps.mak", deps, topComment) 29*8af74909SZhong Yang 30*8af74909SZhong Yang # Create the dependencies file for MSVC 31*8af74909SZhong Yang 32*8af74909SZhong Yang # Place the objects in $(DIR_O) and change extension from ".o" to ".obj" 33*8af74909SZhong Yang deps = [["$(DIR_O)/"+Dependencies.PathStem(obj)+".obj", headers] for obj, headers in deps] 34*8af74909SZhong Yang 35*8af74909SZhong Yang Dependencies.UpdateDependencies("../win32/nmdeps.mak", deps, topComment) 36*8af74909SZhong Yang 37*8af74909SZhong Yangif __name__ == "__main__": 38*8af74909SZhong Yang Generate()