Code Monkey home page Code Monkey logo

depsubdirmakefile's Introduction

DepSubdirMakefile

A solution shows how to compile a project with dependency.

Brief

DepSubdirMakefile is a tiny project shows how to compile a project which has multi-sub-directory with dependency. In the other words, one or more sub-directory need to be compile firstly bacause other sub-directory required. It's a common suitation in project and DepSubdirMakefile provides a easy and efficient solution. Notice that this DepSubdirMakefile only works on Linux or Unix-like environment.

Requirement

  • GNU Make
  • GNU C compiler (it can be configured as other compiler via environment varibale "CC")

Directory Structure

  • build:  makefile entrace for building project.
  • code:  project code, inlude all sub-directory. And directory dep needed to be compiled firstly.
  • obj:  ouput directory during build.
  • AUTHORS
  • ChangLog
  • LICENSE:  DepSubdirMakefile is licensed under the WTFPL2.
  • readme.html / readme-zh.html / README.md
  • test.sh:  one-key test script with Linux Shell format.
  • VERSION:  version code of DepSubdirMakefile

How it works & How to make?

Directory dep is a dependency item and needed to be compiled to a dynamic library file(libdep.so) under obj firstly. There is only a add opertaion function in this dynamic library file. Each of other sub-directory will generate a excutable file(bacause of only one .c files under these directory) and try creating a dynamic link to libdep.so. Besides, every executable files have the same name with corresponding .c file add opertaion function will be called in these excutable files. There are two ways to build this project:

  • Execute makefile under directory build. You can get what paramter the makefile supports via make help . Besides, you can choose which sub-directory which take part in build via command make + [name of sub-directory].It's noticed that this way only do build works. If you want to observe running results of target file, you need execute manually.
  • Run test.sh. You can get what paramter the script supports via paramter -h or --help . This script can complete build works and run target executable files in one time.

Contribution

You can pull request it or send e-mail to us if you have any words about this project.

depsubdirmakefile's People

Contributors

weilunfong avatar

Forkers

xjhsxjh

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.