Dev Blog

./dev



Original theme by orderedlist (CC-BY-SA)


Where applicable, all content is licensed under a CC-BY-SA.
Creative Commons License

Example C Project Template

This is a basic template for using automake tools for creating the configure and Makefile in a C/C++ program.

Requirements

main.c

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
  printf("hello, friend\n");
}

configure.in

AC_INIT([hellofriend], [0.1], [abetusk@mechaelephant.com])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Makefile.am

AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = hellofriend
hellofriend_SOURCES = main.c

Run automake

aclocal
autoconf
automake --add-missing

configure, make, make install

./configure
make
make install

References

2017-08-05