mirror of
https://github.com/tailix/autotools-project.git
synced 2025-02-10 15:45:03 -05:00
Add library example
This commit is contained in:
parent
9ee872884d
commit
1c0a3c58ec
8 changed files with 40 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -34,6 +34,7 @@
|
||||||
# Custom
|
# Custom
|
||||||
|
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
|
/include/Makefile.in
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
# Only generated when configuring in root #
|
# Only generated when configuring in root #
|
||||||
|
@ -51,5 +52,6 @@
|
||||||
# Custom
|
# Custom
|
||||||
|
|
||||||
/Makefile
|
/Makefile
|
||||||
|
/include/Makefile
|
||||||
|
|
||||||
/autotools-project
|
/autotools-project
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
SUBDIRS = include
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-std=c99 \
|
-std=c99 \
|
||||||
-pedantic \
|
-pedantic \
|
||||||
|
@ -7,6 +9,10 @@ AM_CFLAGS = \
|
||||||
-I$(top_srcdir)/include
|
-I$(top_srcdir)/include
|
||||||
|
|
||||||
bin_PROGRAMS = autotools-project
|
bin_PROGRAMS = autotools-project
|
||||||
|
lib_LIBRARIES = libautotools-project.a
|
||||||
|
|
||||||
autotools_project_SOURCES = \
|
autotools_project_SOURCES = \
|
||||||
src/main.c
|
src/main.c
|
||||||
|
|
||||||
|
libautotools_project_a_SOURCES = \
|
||||||
|
src/lib.c
|
||||||
|
|
|
@ -12,4 +12,4 @@ Don't forget to change the following files:
|
||||||
* `Makefile.am`
|
* `Makefile.am`
|
||||||
* `README.md`
|
* `README.md`
|
||||||
|
|
||||||
Remove submodule `vendor/cross` if you don't need it.
|
Remove directory `include` and submodule `vendor/cross` if you don't need them.
|
||||||
|
|
|
@ -17,6 +17,7 @@ AM_INIT_AUTOMAKE([1.9 subdir-objects])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
include/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_LANG([C])
|
AC_LANG([C])
|
||||||
|
|
2
include/Makefile.am
Normal file
2
include/Makefile.am
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
nobase_include_HEADERS = \
|
||||||
|
autotools-project.h
|
14
include/autotools-project.h
Normal file
14
include/autotools-project.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef _AUTOTOOLS_PROJECT_H
|
||||||
|
#define _AUTOTOOLS_PROJECT_H 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int autotools_project(int a, int b);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
10
src/lib.c
Normal file
10
src/lib.c
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <autotools-project.h>
|
||||||
|
|
||||||
|
int autotools_project(const int a, const int b)
|
||||||
|
{
|
||||||
|
return a + b;
|
||||||
|
}
|
|
@ -1,3 +1,7 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(const int argc __attribute__((unused)), char **const argv __attribute__((unused)))
|
int main(const int argc __attribute__((unused)), char **const argv __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue