mirror of
https://github.com/tailix/autotools-project.git
synced 2024-11-25 13:55:43 -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
|
||||
|
||||
/Makefile.in
|
||||
/include/Makefile.in
|
||||
|
||||
###########################################
|
||||
# Only generated when configuring in root #
|
||||
|
@ -51,5 +52,6 @@
|
|||
# Custom
|
||||
|
||||
/Makefile
|
||||
/include/Makefile
|
||||
|
||||
/autotools-project
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
SUBDIRS = include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
|
@ -7,6 +9,10 @@ AM_CFLAGS = \
|
|||
-I$(top_srcdir)/include
|
||||
|
||||
bin_PROGRAMS = autotools-project
|
||||
lib_LIBRARIES = libautotools-project.a
|
||||
|
||||
autotools_project_SOURCES = \
|
||||
src/main.c
|
||||
|
||||
libautotools_project_a_SOURCES = \
|
||||
src/lib.c
|
||||
|
|
|
@ -12,4 +12,4 @@ Don't forget to change the following files:
|
|||
* `Makefile.am`
|
||||
* `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([
|
||||
Makefile
|
||||
include/Makefile
|
||||
])
|
||||
|
||||
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)))
|
||||
{
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue