Git Product home page Git Product logo

temp's Introduction

Template Project

This project can be used as a template for your next little C project. It comes with lots of "frog DNA" from libite (-lite), that holds utility functions missing from the standard C library, and an epoll() based event loop from libuEv -- all you need for that made-easy programming experience!

The project is built using GNU autotools, in a special stripped-down setup that even the most die-hard CMake or Meson champion will find user friendly.

Take Care!
/Joachim <3

Example

The included source is an example of how to periodically poll the Linux hwmon temperature sensors and save data to a JSON file for consumption by some other tool.

Since the program has external dependencies, you need to install them first. On a Debian/Ubuntu based system:

sudo apt install libuev-dev libite-dev pkg-config

The latter is used by the build system to find the libraries.

Building

This repo is meant to be used as an example and template, so it does not contain any tarball releases. These artifacts can be created using the command make dist, when you have configured the project.

To get the most out of this example you need to know a few things about the Autotools build system and the key components:

  • configure.ac and the per-directory Makefile.am are source files
  • configure and Makefile.in are generated from autogen.sh
  • Makefile are generated by the configure script

I subscribe to the tenet that generated files should not be saved in version control systems. That is why none of my projects have these files in GIT. The generated tarballs (above), however, do and that is why they are more suitable for end-user consumption.

To build the example you must, of course, first clone the repository and then run the autogen.sh script. This requires you to have automake and autoconf installed on your system (we assume you already have the C compiler and make installed):

sudo apt install autoconf automake

Finally, clone and build:

git clone https://github.com/troglobit/template.git
cd template/
./autogen.sh
./configure && make

If you are using a different Linux or UNIX distribution, check the output from ./configure --help, followed by make all install. For instance, building on Alpine Linux:

PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure \
    --prefix=/usr --localstatedir=/var --sysconfdir=/etc

Provided the library dependencies (above) were built and installed in the /usr/local/ directory. This PKG_CONFIG_LIBDIR trick may be needed on other GNU/Linux, or UNIX, distributions as well.

temp's People

Contributors

troglobit avatar

Stargazers

 avatar

Watchers

 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.