Giter VIP home page Giter VIP logo

header-gen's Introduction

dependencies
============

LLVM/Clang 3.3 (built from source)
make 3.82 or above (3.81 will definitely not work)
python-termcolor (can be find at contrib/termcolor-1.1.0)
sqlite3-devel

Build howto
===========

1. header-gen requires a modified version based on LLVM/clang 3.3. Please
   download LLVM/Clang 3.3, apply the patch in patch/clang to Clang source and
   build the modified compiler suite.

2. Copy the bin/ and lib/ (or lib64/) of the installed LLVM/Clang here. The
   layout may look like this:
    header-gen
    ├── bin
    ├── clang-plugins
    ├── contrib
    ├── DeclComposer.py
    ├── envsetup.sh
    ├── lib64
    ├── linux
    ├── Makefile.inc
    ├── patch
    ├── README          <--- This file ---
    └── unittests

3. Follow clang-plugins/README to build and install DeclFilter.so.

Run unittests
=============

1. Execute:

    [xx@xx header-gen]$ source envsetup.sh
    [xx@xx header-gen]$ cd unittests
    [xx@xx unittests]$ make

   Note: Please remember to 'source envsetup.sh' this step again once you launch
   a new bash session!

   For each *.c in unittests/, the following files will be generated:
     - *.oo: object built with original headers (i.e. headers in unittests/include)
     - *.sqlite: database of symbols usages generated by DeclFilter.so
     - *.d/: directory containing generated headers
     - *.log/: directory containing random logs from DeclComposer.py
     - *.o: object built with generated headers (i.e. *.d/)

   You can test a single source (e.g. basic.c) by:

    [xx@xx unittests]$ make basic.o

2. Execute:

    [xx@xx unittests]$ make clean

   to remote generated files

Generate headers for Linux drivers
==================================

1. Change LINUX_DIR to the path of linux source tree on your box, and configure
   ARCH, BOARD, TOOLCHAIN_PREFIX and PLATFORM_CC_FLAGS according to your needs.

2. In the top directory, execute:

    [xx@xx header-gen]$ source envsetup.sh

   Note: Please remember to do this step again once you launch a new bash session!

3. Enter the directory 'linux':
    [xx@xx header-gen]$ cd linux

4. Copy your driver sources (e.g. virtio):
    [xx@xx linux]$ cp /path/to/your/drivers/virtio . -r
   Note: the driver sources should be all placed in a single directory.

5. Append the name of the directory ('virtio' in the above example) to the
   'directories' variable at line 9 in Makefile.

6. Try generating headers:

    [xx@xx linux]$ make virtio.o

header-gen's People

Contributors

mikewangexe avatar chyyuu-tsinghua-cs avatar uuyych avatar

Watchers

James Cloos avatar chyyuu avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.