Skip to content

Commit

Permalink
Initial version of foo, a simple library dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlarsson committed Nov 23, 2020
0 parents commit 3e8d3c3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PREFIX=/usr
LIBDIR = ${PREFIX}/lib
INCLUDEDIR = ${PREFIX}/include
DATADIR = ${PREFIX}/share

SOVERSION=1.0.0

all: libfoo.so.$(SOVERSION)

foo.o: foo.c
$(CC) -c -fpic foo.c $(CFLAGS) $(CPPFLAGS)

libfoo.so.$(SOVERSION): foo.o
$(CC) -shared ${LDFLAGS} -Wl,-soname,libfoo.so.1 -o libfoo.so.$(SOVERSION) foo.o

install: libfoo.so.$(SOVERSION)
mkdir -p $(DESTDIR)$(LIBDIR)
install libfoo.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/
(cd $(DESTDIR)$(LIBDIR) && ln -s -f libfoo.so.$(SOVERSION) libfoo.so.1 && ln -s libfoo.so.$(SOVERSION) libfoo.so )
mkdir -p $(DESTDIR)$(INCLUDEDIR)
install foo.h $(DESTDIR)$(INCLUDEDIR)
mkdir -p $(DESTDIR)$(DATADIR)/foo
install readme.txt $(DESTDIR)$(DATADIR)/foo
8 changes: 8 additions & 0 deletions foo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>
#include "foo.h"

void
do_the_foo (int v)
{
printf ("foo: %d\n", v);
}
1 change: 1 addition & 0 deletions foo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void do_the_foo (int v);
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a simple example of a C library dependency.

0 comments on commit 3e8d3c3

Please sign in to comment.