`
johnson.lee
  • 浏览: 53090 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

模块化工程构建工具 - XBuild

阅读更多
Xbuild is project auto build tool, it's just a simple wrapper of GNUMake. The home page is https://sourceforge.net/projects/xbuild/


1.How to install
----------------
tar -xzvf xbuild-<version>.tar.gz -C /usr/local/sbin

2.Syntax specificatio of build.mk file
--------------------------------------

- Overview
  An build.mk file is written to describe your sources to the build system. More
  specifically:

  o The file is really a tiny GNU Makefile fragment that will be parsed one or
    more times by the build system. As such, you should try to minimize the
    variables you declare there and do not assume that anything is not defined
    during parsing.

  o The file syntax is designed to allow you to group your sources into
    'modules'. A module is one of the following:

    * a static library
    * a shared library
    * a executable

    You can define one or more modules in each build.mk file, and you can use
    the same source file in several modules.

  o The build system handles many details for you. For example, you don't need
    to list header files or explicit dependencies between generated files in
    your build.mk. The build system will compute these automatically for you.

    This also means that, when updating to newer releases of the XBuild, you
    should be able to benefit from new toolchain/platform support without having
    to touch your build.mk files.

- Simple example:
  Before describing the syntax in details, let's consider the simple "hello"
  example, assume the structure of "hello" project is following:
 
    hello
    ├─include
    │ └─hello.h
    ├─src
    │ ├─build.mk
    │ └─hello.c
    └─build.mk

  Here, we can see:
 
  o The 'src' directory containing the c source for the sample project.
  o The 'include' directory containing the c header file for the sample project.
  o The 'hello/build.mk' file that describles the sub diretory to build system.
    Its content is:

    ---------- cut here ----------
    include $(all-subdir-makefiles)
    ---------- cut here ----------
  o The 'src/build.mk' file that describles the shared library to build system.
    Its content is:
   
    ---------- cut here ----------
    $(call prepare-build)
   
    MODULE      := hello
    INCLUDES    := ../include
    CFLAGS      := -O3 -Wall -ggdb -D_DEBUG
    CPPFLAGS    :=
    CXXFLAGS    := $(CPPFLAGS)
    LDFLAGS     := -L/usr/local/lib -L/usr/lib
    LDLIBS      :=
    SHARED_LIBS :=
    STATIC_LIBS :=
    SOURCES     := hello.c
   
    $(call build-shared-library)
    ---------- cut here ----------

- Xbuild provided evironment variables

  o ARCH
    The architecture of the CPU

  o XBUILD_PROJECT
    The absolute path of project

- Xbuild provided variables

  o MODULE
    This variable is required, it's describled the module name.

  o INCLUDES
    A set of C/C++ header file include directory, for example:

      INCLUDES := ../include
      INCLUDES += ../../include

  o CFLAGS
    A set of compile flags for .c source file, for example:

      CFLAGS := -O3 -Wall -ggdb -D_DEBUG

  o CPPFLAGS
    A set of compile flags for .cpp source file, for example:

      CPPFLAGS := -O3 -Wall -ggdb -D_DEBUG -std=gnu++0x

  o CXXFLAGS
    A set of compile flags for .cxx and .cc source file, for example:

      CXXFLAGS := -O3 -Wall -ggdb -D_DEBUG -std++   

  o LDFLAGS
    A set of link flags for build shared library, static library orcutable,
    for example:

      LDFLAGS := -L/usr/local/lib -L/usr/lib -L$(call pwd)/../lib

    NOTE: If the path is relative, should use the function $(call pwd) to locate
    current directory. 

  o LDLIBS
    A set of external library to link, for example:

      LDLIBS := -lrt -lpthr

  o SHARED_LIBS
    A set of shared library module name that dependencied by current module,
    for example:

    SHARED_LIBS := module-foo module-bar

    If the SHARED_LIBS is defined, the module linked after all of dependency
    module linked success.

  o STATIC_LIBS
    A set of static library module name that dependencied by current module,
    it's the same of SHARED_LIBS.

  o SOURCES
    A set of source file to compile.

- Xbuild provided functions & macros

  o add-suffix
  o build-shared-library
  o build-static-library
  o build-executable
  o pwd
  o all-subdir-makefiles
 
  About the details, please see '$Xbuild/core/definitions.mk'

4.Build project
---------------
Usage of xbuild command:

  cd <project-directory>
  xbuild all

  or

  xbuild r[ebuild]
   
   
分享到:
评论

相关推荐

    vue-multipage vue 模块化开发打包

    Vue-multipage 就是针对Vue.js 应用的多页面模块化构建工具。它结合了Webpack等现代前端构建工具,使得在Vue.js应用中实现多页面开发变得更为简单。 Webpack 是一个模块打包器,它能够将JavaScript、CSS、图片等...

    QT模块化编程 pro pri 子工程 使用

    QT模块化编程是一种高效组织大型项目的方式,它允许我们将复杂的应用程序分解为多个独立的、可重用的模块或子工程。在QT中,我们通常使用`.pro`和`.pri`文件来管理这些模块。`.pro`文件是QT项目的主配置文件,用于...

    (源码)基于Webpack的模块化构建工具.zip

    # 基于Webpack的模块化构建工具 ## 项目简介 本项目是一个基于Webpack的模块化构建工具。Webpack是一个强大的模块打包工具,能够处理JavaScript、CSS、SCSS、图片、模板等多种类型的文件,并将它们打包成浏览器可...

    前端构建尝试1-构建工具源代码

    `Browserify` 是一个用于解决在浏览器中使用 CommonJS 规范的模块化开发问题的工具。它允许开发者将Node.js风格的`require()`语法应用于前端代码,使得代码可以按照模块化的方式组织,便于复用和管理。`Browserify`...

    开源大数据ETL工具的模块化组件构建技术研究.pdf

    本文详细探讨了开源大数据ETL(Extract-Transform-Load)工具中模块化组件构建的技术方法,并以Kettle这个开源ETL软件作为案例,分析了其模块化组件构建的实践应用。Kettle是Pentaho数据集成(PDI)系统的一个重要...

    JavaScript前端开发模块化教程_源代码.rar

    3. **模块化工具与框架** - **Webpack**:强大的模块打包工具,可以处理各种静态资源,并提供模块热替换、代码分割等功能。 - **Rollup**:轻量级的模块打包工具,专注于优化JavaScript库的构建。 - **Browserify...

    swift-iOS模块化构建方案模块间解耦路由中心设计方案

    "swift-iOS模块化构建方案模块间解耦路由中心设计方案"正是针对这一问题提出的解决方案,它旨在通过模块化设计和路由中心来实现应用组件间的高效解耦。 模块化构建方案的核心思想是将一个大型的项目拆分成多个小型...

    fedao学而思在线前端工程构建工具

    【标签】:“JavaScript开发-构建工具”表明这套构建工具的核心是JavaScript,它主要服务于JavaScript开发者,通过自动化工具帮助开发者解决项目构建中的各种问题,例如代码转换、优化、打包等,使开发者可以专注于...

    Magisk模块:Move_Certificates-v1.9

    总的来说,Move_Certificates-v1.9模块通过自动化证书的导入过程,提高了用户在Android设备上管理安全连接的效率。用户只需在Magisk环境中安装此模块并重启设备,就可以享受更加便捷的证书管理体验。然而,值得注意...

    工程级前端构建工具

    工程级前端构建工具在现代Web开发中扮演着至关重要的角色,它们通过自动化流程极大地提高了开发效率,确保代码质量,使得大型项目的管理变得有序且高效。本文将深入探讨这些工具的核心功能、常用工具以及如何在实际...

    嵌入式系统的微模块化程序设计:实用状态图C_C++实现.pdf

    《嵌入式系统的微模块化程序设计:实用状态图C_C++实现》是一本专为嵌入式系统设计人员及计算机科学和电气工程领域的学生编写的教程书。本书由美籍波兰裔博士Miro Samek撰写,中文版由三万钧翻译,详细介绍了量子...

    front-end-handbook-2017(前端开发指南)

    - 数据可视化工具 - 图形工具(SVG、Canvas、WebGL) - 前端数据存储工具 - HTTP/网络工具 - 代码编辑工具 - HTML/CSS/JavaScript工具 - 静态网页构建工具 - 无障碍访问工具 - 渐进式Web应用工具 - 脚手架...

    springboot模块化框架

    使用Jenkins、GitLab CI/CD等工具,自动化构建、测试和部署各个模块,确保整个流程的高效和稳定。 通过以上对SpringBoot模块化框架的分析,我们可以看出其在提高开发效率、增强代码可维护性和扩展性方面的优势。在...

    模块化的nf-HiPAC

    原版的nf-hipac需要为内核打patch,且只支持较低版本的内核,构建起来相对比较...模块化后的nf-hipac可以直接作为内核可加载模块编译,且适配了高版本的Linux内核。为了移植工作简化,去掉了和iptables模块的联动支持!

    一种基于逻辑的Java模块依赖图构建工具.pdf

    然而,Java模块依赖图的构建工具并不普遍,这种稀缺性在一定程度上限制了基于MDG图的软件模块聚类算法的广泛应用。为了应对这一挑战,研究人员提出了基于逻辑的Java模块依赖图构建工具TL4JMDG(the tool logic-based...

    微信小程序-微信小程序框架-模块化组件开发工具

    微信小程序模块化组件开发“框架” 更新日志:Changelog 简介 使小程序开发可以采用模块化的开发方式。没有任何构建相关的骨架或者约束。在运行阶段自动通过getter/setter,将你的“模块化组件”的数据和方法的...

    smm分模块构建工程

    在这个项目中,开发者采用了Maven作为构建工具,通过模块化的方式对系统进行拆分,以提升代码的复用性和可维护性。下面我们将详细探讨这些关键知识点。 1. **Maven**:Maven是一个项目管理和综合工具,它帮助开发者...

    基于Vue的模块化组件化工程化编码应用例子

    总结,基于Vue的模块化、组件化和工程化编码应用例子展示了如何利用Vue.js构建高效、可维护的前端应用。通过模块化组织代码,组件化构建UI,以及Vue CLI带来的工程化实践,开发者能够更好地应对复杂项目的需求。

    (源码)基于Vue的企业级模块化工程.zip

    编译思想和组件设计方案借鉴了Vben框架,旨在构建高效、可维护、模块化的前端应用。 ## 项目的主要特性和功能 1. 模块化设计功能模块职责边界清晰,方便独立开发、测试和维护。 2. 灵活的服务配置通过环境变量可...

    校企合作下电子信息工程技术专业模块化课程体系的构建.docx

    【摘要】:本文探讨了在校企合作背景下,如何构建电子信息工程技术专业的模块化课程体系,以适应社会和企业发展的需求。作者提出,构建这样的课程体系需要一个适应社会和企业发展需求的教师团队,一个科学合理的模块...

Global site tag (gtag.js) - Google Analytics