Makefile processing method, system and equipment and medium

By automating the Makefile file processing process, including intelligent identification of the compilation platform and path relative processing, the traditional Makefile file processing method is solved under the needs of multi-role division of labor and multi-platform compilation, and efficient software engineering compilation and code management are achieved.

CN119987846APending Publication Date: 2025-05-13SINO TRUK JINAN POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510205317.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

When facing the multi-role division of labor and multi-platform compilation needs of modern embedded software development, the traditional Makefile file processing method seems to be unscrupulous, lacks in-depth adaptation to the characteristics of embedded software, and the data processing methods are relatively backward, and lacks efficient management and optimization mechanisms.

Method used

By automating the Makefile file processing process, including intelligent identification of the compilation platform, path relative processing and field standardization settings, the software code project is divided into underlying software code files and application software code files, and is encapsulated and stored separately to realize the compilation of the background command line batch processing method.

Benefits of technology

It greatly improves the compilation efficiency, portability and code management convenience of software engineering, ensures the compilability and portability of software engineering on different compilation platforms, reduces the workload of manually configuring the compilation environment, and simplifies the writing and maintenance of Makefile files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987846A_ABST
    Figure CN119987846A_ABST
Patent Text Reader

Abstract

The invention provides a makefile processing method, a makefile processing system, makefile processing equipment and a medium, and belongs to the technical field of computer software. The method comprises the following steps: firstly, dividing a software code into a bottom layer and an application layer, packaging and storing, and then packaging an engineering file and obtaining a compiling platform path of a target PC; and under the compiling root directory, determining a compiling platform by retrieving keyword information of the main makefile. Then, a target makefile is selected according to platform attributes, an include field of a main makefile is adjusted to contain necessary subfiles, a link and a compilation command are set as a relative path and a platform exclusive command, and a clean function is limited; in addition, SUBDIRS, CSRCS, OBJS, and CDEPS fields of the sub makefile are processed to enhance portability. And finally, executing make compiling in a background command line batch processing mode, and efficiently completing software engineering construction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer software, and more specifically relates to a makefile file processing method, system, equipment and medium. Background Art

[0002] In the complex environment of embedded system development, Makefile plays a vital role. It defines the compilation and linking rules of the entire code project and is the cornerstone of automatic compilation. However, the traditional Makefile processing method is unable to cope with the multi-role division of labor and multi-platform compilation requirements of modern embedded software development.

[0003] In a typical embedded software development process, there is a clear division of labor between basic software developers and application software developers, but there is a bottleneck in the collaboration between the two in the code integration and compilation process. Application code is frequently iterated, tested and optimized, while Makefile files are often manually maintained by basic software developers, which is not only inefficient but also prone to errors. Especially when facing different compilation platforms, Makefile files need to be adjusted accordingly, which undoubtedly increases the complexity and error rate of manual operations.

[0004] In addition, the existing Makefile file processing method lacks in-depth adaptation to the characteristics of embedded software. There are many types of embedded systems, different hardware platforms, and different requirements for compilation tool chains. Traditional Makefile files can often only be configured for specific compilation platforms and lack multi-platform adaptability. This not only limits the flexibility of embedded software development, but also increases the difficulty of software porting and maintenance.

[0005] More importantly, the existing Makefile file data processing methods are relatively backward and lack efficient management and optimization mechanisms. With the increasing scale of embedded software, the complexity and maintenance cost of Makefile files are also increasing. How to efficiently process Makefile file data and improve compilation efficiency has become an urgent problem to be solved in the field of embedded software development. Summary of the invention

[0006] In view of the above problems, the purpose of the present invention is to provide a makefile file processing method, system, device and medium, which greatly improves the compilation efficiency, transplantation capability and code management convenience of software engineering by automating the makefile file processing flow, including intelligent recognition of compilation platform, path relativization processing and field standardization setting.

[0007] In order to achieve the above object, the present invention is implemented through the following technical solutions: In a first aspect, an embodiment of the present application provides a makefile file processing method, comprising: Divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately; Package the software code project files and obtain the compilation platform software path installed on the target PC; In the compilation and debugging root directory, find out the main makefile file in the software code project file, extract the keyword information of the main makefile file, and search in the compilation platform identification keyword template in the system according to the keyword information to determine the compilation platform corresponding to the current software project; According to the determined compilation platform, the target main makefile and target sub-makefile to be processed are determined based on the platform attributes; For the target main makefile, add the target main makefile root directory and the target sub-Makefile in the ASW directory to the include field, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function; For the target sub-makefile file, the SUBDIRS field of the target sub-makefile file in the root directory of the target main makefile file is processed, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file in each subdirectory under the root directory of the target main makefile file are processed to ensure the portability of software engineering compilation; Use background command line batch processing to perform make compilation, call the makefile file, and complete the compilation of the software project.

[0008] In an optional implementation, the software code engineering file is divided into a bottom-level software code file and an application software code file, and the two files are packaged and stored separately, including: In the software code engineering file system, the code files in the folders named BSW, RTOS, RTE, and MCAL are regarded as the underlying software code files, and the other code files are regarded as the application software code files; The underlying software code files are encapsulated as library files with the extension a, and the application software code files are stored in a folder named ASW.

[0009] In an optional implementation, the method of searching for a main makefile file in a software code engineering file in a compilation and debugging root directory, extracting keyword information of the main makefile file, and searching a compilation platform identification keyword template in a system according to the keyword information to determine a compilation platform corresponding to a current software engineering project includes: In the compilation and debugging root directory, find the system file named makefile as the main makefile file; Get the path name of the main makefile and the gcc compile command line string, and extract the corresponding compile path name keywords; The compile platform identification keyword template in the system is searched according to the compile path name keyword to determine the compile platform corresponding to the current software project.

[0010] In an optional implementation, adding the target sub-makefile files under the target main makefile file root directory and the ASW directory to the include field includes: Add the target sub-makefile files in the root directory of the target main makefile file to the -include field line by line; Traverse the ASW directory and add the target sub-makefile file names and their relative path names of the ASW root directory and its subdirectories to the -include field line by line.

[0011] In an optional implementation, the step of adjusting the ld link path and the gcc compilation command to a relative path and a command corresponding to the compilation platform, and defining the clean function, includes: Read the # Tool invocations field and change the path identifier of the ld link file to a relative path format; read the gcc compile command line field and select the gcc command word corresponding to the compile platform to be adjusted; Limit the clean function to clearing files with extensions o and d in the root directory and subdirectories of the target main makefile.

[0012] In an optional implementation, the processing of the SUBDIRS field of the target sub-makefile file under the root directory of the target main makefile file includes: In the target sub-makefile in the target main makefile's root directory, traverse the ASW directory and add the relative path of its root directory and all sub-directories to the SUBDIRS field.

[0013] In an optional implementation, the processing of the C_SRCS field, the OBJS field, and the C_DEPS field of the target sub-makefile file in each sub-directory under the root directory of the target main makefile file includes: Add all file names with extension c and their relative path names in the current subdirectory to the C_SRCS field line by line; Update the extension of each file name with extension c in the current subdirectory to o, and add the file name and its relative path name to the OBJS field one by one line by line; Update the extension of each file name with extension c in the current subdirectory to d, and add the file name and its relative path name to the C_DEPS field one by one line by line; For the -I fields in all target sub-makefiles, change the absolute paths in them to paths relative to the software project.

[0014] In a second aspect, an embodiment of the present application further provides a makefile file processing system, comprising: The software code engineering division module is used to divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately; The path acquisition module is used to package the software code engineering files and obtain the compilation platform software path installed on the target PC; The compiling platform determining module is used to find the main makefile file in the software code engineering file in the compiling and debugging root directory, extract the keyword information of the main makefile file, and search the compiling platform identification keyword template in the system according to the keyword information to determine the compiling platform corresponding to the current software engineering; A target file determination module is used to determine the target main makefile and target sub-makefile to be processed based on the determined compilation platform and platform attributes; The target main makefile file processing module is used to add the target main makefile file root directory and the target sub-makefile file under the ASW directory to the include field for the target main makefile file, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function; The target sub-makefile file processing module is used to process the SUBDIRS field of the target sub-makefile file under the root directory of the target main makefile file, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file under each subdirectory under the root directory of the target main makefile file to ensure the portability of software engineering compilation; The compilation module is used to perform make compilation in the background command line batch processing mode, call the makefile file, and complete the compilation of the software project.

[0015] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the makefile file processing method as described in any one of the above items are implemented.

[0016] In a fourth aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the makefile file processing method as described in any one of the above items are implemented.

[0017] It can be seen from the above technical solutions that the present invention has the following advantages: In the makefile file processing method provided by the present application, the software code project is first divided, the bottom software part is encapsulated into the form of .a library files, and the application software code is stored in the form of fixed folders. By analyzing the software code project, the mainstream compilation platform adapted to the code is automatically identified according to the analysis results, and the makefile file is regenerated for the project code according to the corresponding rules, batch processing in the form of background command lines can be automatically run, thereby improving the efficiency of software code integration and testing. This method is suitable for application developers and testers who do not pay attention to basic software development, saving development time and improving work efficiency.

[0018] This application ensures the compilability and portability of software engineering on different compilation platforms by dividing software code engineering files into underlying software code files and application software code files, encapsulating and storing them, and processing makefile files.

[0019] The present application automatically determines the compilation platform corresponding to the current software project by extracting keyword information of the main makefile file and searching it in the compilation platform identification keyword template in the system, thereby reducing the workload of manually configuring the compilation environment.

[0020] This application uniformly processes the fields of the target main makefile and sub-makefile, such as adjusting the ld link path and gcc compilation command to relative paths and commands corresponding to the compilation platform, and automating the processing of fields such as SUBDIRS, C_SRCS, OBJS and C_DEPS, which simplifies the writing and maintenance of makefile files.

[0021] This application performs make compilation through background command line batch processing, calls the makefile file to complete the compilation of the software project, and improves the automation and efficiency of the compilation.

[0022] The processing of the makefile file in this application makes the code structure clearer, the field processing more standardized, and enhances the readability and maintainability of the code. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0024] Figure 1 A flowchart of the makefile file processing method provided in this application.

[0025] Figure 2 A schematic diagram of the structure of the makefile file processing system provided for this application.

[0026] Figure 3 A schematic diagram of the structure of the electronic device provided in this application. DETAILED DESCRIPTION

[0027] In the specific steps of the makefile file processing method described in detail below, various embodiments of the present disclosure will be described more comprehensively. The present disclosure may have various embodiments, and adjustments and changes may be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to cover all adjustments, equivalents and / or alternatives that fall within the spirit and scope of the various embodiments of the present disclosure.

[0028] Hereinafter, the terms "include" or "may include" used in various embodiments of the present disclosure indicate the presence of disclosed functions, operations, or elements, and do not limit the addition of one or more functions, operations, or elements. In addition, as used in various embodiments of the present disclosure, the terms "include", "have", and their cognates are intended only to indicate specific features, numbers, steps, operations, elements, components, or a combination of the foregoing, and should not be understood as first excluding the presence of one or more other features, numbers, steps, operations, elements, components, or a combination of the foregoing or the possibility of adding one or more features, numbers, steps, operations, elements, components, or a combination of the foregoing.

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] See also Figure 1 The figure is a flow chart of a method for processing a makefile file in a specific embodiment, the method comprising: S1: Divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately.

[0031] For example, in the software code engineering file system, the code files in the folders named BSW, RTOS, RTE, and MCAL are used as underlying software code files, and the other code files are used as application software code files; the underlying software code files are encapsulated as library files with an extension of a, and the application software code files are stored in a folder named ASW.

[0032] In this step, the underlying software part is relatively fixed and encapsulated into a library file .a file format, and the application software code is stored in a fixed folder format, which is uniformly named ASW, and only the ASW source code format is retained. This division process can reduce the makefile file processing time for the underlying software code, and reduce its subsequent linking and compilation time, thereby improving the efficiency of software integration compilation.

[0033] S2: Package the software code project files and obtain the compilation platform software path installed on the target PC.

[0034] S3: In the compilation and debugging root directory, find the main makefile file in the software code project file, extract the keyword information of the main makefile file, and search in the compilation platform identification keyword template in the system according to the keyword information to determine the compilation platform corresponding to the current software project.

[0035] In the example, first, in the compilation and debugging root directory, find the system file named makefile as the main makefile file; then, obtain the path name of the main makefile file and the gcc compilation command line string, and extract the corresponding compilation path name keyword; finally, search the compilation platform identification keyword template in the system according to the compilation path name keyword to determine the compilation platform corresponding to the current software project.

[0036] In this step, the path name of the main makefile file in the extracted software project is compared to identify the compiling platform attribute. Specifically, the compiling path name keyword is extracted and compared with the compiling platform identification keyword template in the system to determine the compiling platform corresponding to the current software project, so as to facilitate the adoption of corresponding makefile processing methods for different platforms.

[0037] S4: According to the determined compilation platform, a target main makefile and a target sub-makefile to be processed are determined based on platform attributes.

[0038] For example, according to the compilation platform determined above, the corresponding compilation platform properties are retrieved, and according to the platform properties, the target main makefile file name and the target sub-makefile file name that need to be automatically processed are obtained.

[0039] S5: For the target main makefile file, add the target main makefile file root directory and the target sub-makefile file under the ASW directory to the include field, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function.

[0040] For example, first, add the target sub-makefile files in the root directory of the target main makefile file to the -include field line by line; then traverse the ASW directory, and add the target sub-makefile file names and their relative path names in the ASW root directory and its subdirectories to the -include field line by line.

[0041] In addition, the # Tool invocations field is read to change the path identifier of the ld link file to a relative path format; the gcc compilation command line field is read, and the gcc command word corresponding to the corresponding compilation platform is selected and adjusted; finally, the clean function is limited to clearing files with extensions o and d in the root directory and subdirectories of the target main makefile file.

[0042] By processing the target main makefile file in the software project in this step, the automatic compilation requirements of the main makefile file can be met, the requirements of different compilation platforms can be adapted, and the dependence of the code project compilation on the path can be eliminated.

[0043] S6: For the target sub-makefile file, the SUBDIRS field of the target sub-makefile file under the root directory of the target main makefile file is processed, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file under each subdirectory under the root directory of the target main makefile file are processed to ensure the portability of software engineering compilation.

[0044] For example, on the one hand, in the target sub-makefile file under the root directory of the target main makefile file, traverse the ASW directory and add the relative paths of its root directory and all sub-directories to the SUBDIRS field. At the same time, all file names with extension c and their relative path names under the current sub-directory are added to the C_SRCS field line by line; the extension of each file name with extension c under the current sub-directory is updated to o, and the file name and its relative path name are added to the OBJS field line by line; the extension of each file name with extension c under the current sub-directory is updated to d, and the file name and its relative path name are added to the C_DEPS field line by line. In addition, for the -I field in all target sub-makefile files, the absolute paths therein are uniformly modified to paths relative to the software project.

[0045] By processing the target sub-makefile file in the software project in this step, the automatic compilation requirements of the main makefile file can be met, the requirements of different compilation platforms can be adapted, and the dependence of the code project compilation on the path can be eliminated.

[0046] S7: Perform make compilation in the background command line batch processing mode, call the makefile file, and complete the compilation of the software project.

[0047] It should be noted that this step adds and modifies the environment variables of the gcc compilation execution file required by the make command. The compilation platform software path installed on the target PC obtained in step S2 is compared with the relative path information stored in the execution files of different platforms. Through the set command processing method, the gcc environment variable setting is increased to ensure the normal operation of the make command.

[0048] In addition, in this method, the matlab scripting language can be used to parse the makefile text file in combination with the above strategy, wherein matlab is a mainstream tool for model-based development of application software, which facilitates the integration of tool chain software. The use of this scripting language for parsing can reduce the difficulty of generating and processing the Makefile file, and is unified with the application software development tool, thereby facilitating the development engineer to carry out the work of code compilation.

[0049] In this embodiment, efficient compilation and debugging of software code engineering is achieved. By dividing the code into the bottom layer and the application layer and encapsulating and storing them, the compilation platform is automatically identified and the makefile file path and commands are adjusted, thereby enhancing the portability and flexibility of software engineering compilation. At the same time, the compilation process is automated by background batch processing, thereby improving development efficiency and the convenience of code management.

[0050] This method allows application developers to not need to worry about the storage path and compilation settings of the software code project, and there is no need to operate different compilation platform software. The application software code can be automatically integrated and compiled directly, reducing the repetitive manual integration work of the underlying software personnel and improving work efficiency.

[0051] In an embodiment of the present invention, based on step S5, a possible embodiment is given below to illustrate its specific implementation in a non-limiting manner.

[0052] The processing of the target main makefile mainly includes: S501: Processing the -include command line field. Add the target sub-makefile file names of the root directory where the target main makefile file is located to the -include field line by line; traverse the ASW directory therein, and add the target sub-makefile file names and their relative path names of the ASW root directory and its sub-directories to the -include field line by line.

[0053] S502: Processing the # Tool invocations field: Changing the path identifier of the ld link file to a relative path format; and selecting and adjusting the gcc command word corresponding to the corresponding compiling platform for the gcc compiling command line field.

[0054] S503: Processing of the clean: command line field. The clean function is limited to clearing the .o and .d files in the root directory and subdirectories of the target main makefile file.

[0055] In an embodiment of the present invention, based on step S6, a possible embodiment is given below to illustrate its specific implementation scheme in a non-limiting manner.

[0056] The processing of the target sub-makefile mainly includes: S601: For the target sub-makefile file under the root directory of the target main makefile file, the SUBDIRS field is processed, the ASW directory is traversed, and the relative path names of the ASW root directory and its sub-directories are added to the SUBDIRS field line by line.

[0057] S602: For the target sub-makefile files in each sub-directory of the target main makefile file, the C_SRCS field is processed, and each .c file name and its relative path name in the current sub-directory are added to the C_SRCS field one by one line by line; for the OBJS field, each .c file name in the current sub-directory is updated to the .o extension and its relative path name is added to the OBJS field one by one line by line; for the C_DEPS field, each .c file name in the current sub-directory is updated to the .d extension and its relative path name is added to the C_DEPS field one by one line by line; in the -I field of other target sub-makefile files, the absolute path is modified to the relative path of the software project.

[0058] like Figure 2 As shown, the following is an embodiment of the makefile file processing system provided by the embodiment of the present disclosure. The system and the makefile file processing methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the makefile file processing system, please refer to the embodiment of the above-mentioned makefile file processing method.

[0059] A makefile file processing system comprises: a software code engineering division module 1, a path acquisition module 2, a compilation platform determination module 3, a target file determination module 4, a target main makefile file processing module 5, a target sub-makefile file processing module 6 and a compilation module 7.

[0060] The software code engineering division module 1 is used to divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately.

[0061] The path acquisition module 2 is used to package the software code engineering files and obtain the compilation platform software path installed on the target PC.

[0062] The compiling platform determining module 3 is used to find the main makefile file in the software code engineering file in the compiling and debugging root directory, extract the keyword information of the main makefile file, and search the compiling platform identification keyword template in the system according to the keyword information to determine the compiling platform corresponding to the current software engineering.

[0063] The target file determination module 4 is used to determine the target main makefile file and the target sub-makefile file to be processed according to the determined compilation platform and based on the platform attributes.

[0064] The target main makefile file processing module 5 is used to add the target main makefile file root directory and the target sub-makefile file under the ASW directory to the include field for the target main makefile file, adjust the ld link path and the gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function.

[0065] The target sub-makefile file processing module 6 is used to process the SUBDIRS field of the target sub-makefile file under the root directory of the target main makefile file, and process the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file under each subdirectory under the root directory of the target main makefile file to ensure the portability of software engineering compilation.

[0066] The compilation module 7 is used to perform make compilation in the background command line batch processing mode, call the makefile file, and complete the compilation of the software project.

[0067] The makefile file processing system provided in this embodiment realizes the hierarchical encapsulation of software code engineering, automatic compilation platform identification and configuration, relative path and platform command adjustment of makefile files, and enhancement of compilation portability, thereby improving the efficiency and flexibility of software engineering compilation, and completing the compilation in background command line batch processing mode, optimizing the development process of software engineering.

[0068] Figure 3 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.

[0069] The makefile file processing method provided in the embodiment of the present application can be applied to electronic devices. It will be appreciated by those skilled in the art that the electronic device structure involved in the embodiment of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or less components than shown, or combine certain components, or arrange different components. In an embodiment of the present invention, the electronic device includes but is not limited to a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the embodiments of the present application described and / or required herein.

[0070] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, buttons, a camera, a display, and a SIM card interface, etc.

[0071] The processor may include one or more processing units, for example, the processor may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors.

[0072] The processor can be the nerve center and command center of the electronic device. The controller can generate an operation control signal according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0073] A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. The memory may store instructions or data that the processor has just used or is cyclically used. If the processor needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor, and thus improves system efficiency.

[0074] The external memory interface can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor through the external memory interface to implement data storage functions. For example, files such as music and videos can be saved in the external memory card.

[0075] The internal memory can be used to store computer executable program codes, which include instructions. The processor executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory. The internal memory may include a program storage area and a data storage area. The internal memory may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0076] The wireless communication function of an electronic device can be realized through an antenna, a wireless communication module, a modem processor, and a baseband processor.

[0077] The wireless communication module can provide wireless communication solutions for electronic devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc.

[0078] Electronic devices can implement audio functions, etc. through audio modules, speakers, receivers, microphones, headphone jacks, and application processors.

[0079] Electronic devices can achieve shooting functions through ISP, camera, video codec, GPU, display and application processor.

[0080] Electronic devices can achieve display functions through GPU, display screen and application processor.

[0081] The GPU is a microprocessor for image processing that connects the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor may include one or more GPUs that execute program instructions to generate or change display information.

[0082] The display screen is used to display images, videos, etc. The display screen includes a display panel.

[0083] The above-mentioned electronic device implements the makefile file processing method of the present application by carefully dividing the software code engineering files into the bottom layer and the application layer and encapsulating and storing them separately, automatically identifying and configuring the compilation platform, adjusting the paths and commands in the makefile file to relative forms and matching the corresponding compilation platform, and optimizing and processing multiple key fields of the makefile file to enhance the portability of the compilation, ultimately achieving the beneficial effect of significantly improving the efficiency and flexibility of software engineering compilation, and completing the entire compilation process in an efficient background command line batch processing manner.

[0084] The storage medium provided in the present application stores a program product that can implement the makefile file processing method.

[0085] Makefile file processing methods include: Divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately; Package the software code project files and obtain the compilation platform software path installed on the target PC; In the compilation and debugging root directory, find out the main makefile file in the software code project file, extract the keyword information of the main makefile file, and search in the compilation platform identification keyword template in the system according to the keyword information to determine the compilation platform corresponding to the current software project; According to the determined compilation platform, the target main makefile and target sub-makefile to be processed are determined based on the platform attributes; For the target main makefile, add the target main makefile root directory and the target sub-makefile in the ASW directory to the include field, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function; For the target sub-makefile file, the SUBDIRS field of the target sub-makefile file in the root directory of the target main makefile file is processed, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file in each subdirectory under the root directory of the target main makefile file are processed to ensure the portability of software engineering compilation; Use background command line batch processing to perform make compilation, call the makefile file, and complete the compilation of the software project.

[0086] In some possible implementations, the makefile file processing method of the present disclosure can be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of this specification.

[0087] The storage medium of the present disclosure can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0088] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A makefile file processing method, characterized in that: include: Divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately; Package the software code project files and obtain the compilation platform software path installed on the target PC; In the compilation and debugging root directory, find out the main makefile file in the software code project file, extract the keyword information of the main makefile file, and search in the compilation platform identification keyword template in the system according to the keyword information to determine the compilation platform corresponding to the current software project; According to the determined compilation platform, the target main makefile and target sub-makefile to be processed are determined based on the platform attributes; For the target main Makefile file, add the target main Makefile file root directory and the target sub-Makefile file under the ASW directory to the include field, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function; For the target sub-makefile file, the SUBDIRS field of the target sub-makefile file in the root directory of the target main Makefile file is processed, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file in each subdirectory under the root directory of the target main Makefile file are processed to ensure the portability of software engineering compilation; Use background command line batch processing to perform make compilation, call the makefile file, and complete the compilation of the software project.

2. The makefile file processing method according to claim 1, characterized in that: The software code engineering files are divided into underlying software code files and application software code files, and are packaged and stored separately, including: In the software code engineering file system, the code files in the folders named BSW, RTOS, RTE, and MCA are regarded as the underlying software code files, and the other code files are regarded as the application software code files; The underlying software code files are encapsulated as library files with the extension a, and the application software code files are stored in a folder named ASW.

3. The makefile file processing method according to claim 2, characterized in that: The method of searching the main makefile file in the software code engineering file under the compilation and debugging root directory, extracting keyword information of the main makefile file, and searching the compilation platform identification keyword template in the system according to the keyword information to determine the compilation platform corresponding to the current software engineering includes: In the compilation and debugging root directory, find the system file named makefile as the main makefile file; Get the path name of the main makefile and the gcc compile command line string, and extract the corresponding compile path name keywords; The compile platform identification keyword template in the system is searched according to the compile path name keyword to determine the compile platform corresponding to the current software project.

4. The makefile file processing method according to claim 3 is characterized in that: The target sub-Makefile files under the target main Makefile file root directory and the ASW directory are added to the include field, including: Add the target sub-Makefile files in the root directory of the target main Makefile file to the -include field line by line; Traverse the ASW directory and add the target sub-makefile file names and their relative path names of the ASW root directory and its subdirectories to the -include field line by line.

5. The makefile file processing method according to claim 4, characterized in that: The step of adjusting the ld link path and the gcc compilation command to a relative path and a command corresponding to the compilation platform, and limiting the clean function, includes: Read the # Tool invocations field and change the path identifier of the ld link file to a relative path format; read the gcc compile command line field and select the gcc command word corresponding to the compile platform to be adjusted; Limit the clean function to clearing files with extensions o and d in the root directory and subdirectories of the target main makefile.

6. The makefile file processing method according to claim 5, characterized in that: The processing of the SUBDIRS field of the target sub-makefile file under the root directory of the target main Makefile file includes: In the target sub-makefile in the target main makefile's root directory, traverse the ASW directory and add the relative path of its root directory and all sub-directories to the SUBDIRS field.

7. The makefile processing method according to claim 6, characterized in that: The processing of the C_SRCS field, the OBJS field, and the C_DEPS field of the target sub-makefile file in each sub-directory under the root directory of the target main makefile file includes: Add all file names with extension c and their relative path names in the current subdirectory to the C_SRCS field line by line; Update the extension of each file name with extension c in the current subdirectory to o, and add the file name and its relative path name to the OBJS field one by one line by line; Update the extension of each file name with extension c in the current subdirectory to d, and add the file name and its relative path name to the C_DEPS field one by one line by line; For the -I fields in all target sub-makefiles, change the absolute paths in them to paths relative to the software project.

8. A makefile file processing system, characterized in that: The system adopts the makefile file processing method as claimed in any one of claims 1 to 7; The system comprises: The software code engineering division module is used to divide the software code engineering files into underlying software code files and application software code files, and encapsulate and store them separately; The path acquisition module is used to package the software code engineering files and obtain the compilation platform software path installed on the target PC; The compiling platform determining module is used to find the main makefile file in the software code engineering file in the compiling and debugging root directory, extract the keyword information of the main makefile file, and search the compiling platform identification keyword template in the system according to the keyword information to determine the compiling platform corresponding to the current software engineering; A target file determination module is used to determine the target main makefile and target sub-makefile to be processed based on the determined compilation platform and platform attributes; The target main makefile file processing module is used to add the target main makefile file root directory and the target sub-Makefile file under the ASW directory to the include field for the target main makefile file, adjust the ld link path and gcc compilation command to the relative path and the command of the corresponding compilation platform, and limit the clean function; The target sub-makefile file processing module is used to process the SUBDIRS field of the target sub-makefile file under the root directory of the target main Makefile file, and the C_SRCS field, OBJS field and C_DEPS field of the target sub-makefile file under each subdirectory under the root directory of the target main Makefile file to ensure the portability of software engineering compilation; The compilation module is used to perform make compilation in the background command line batch processing mode, call the makefile file, and complete the compilation of the software project.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the makefile file processing method according to any one of claims 1 to 7 are implemented.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the makefile processing method according to any one of claims 1 to 7 are implemented.