Skip to content

Commit

Permalink
It should probably be a static library though...
Browse files Browse the repository at this point in the history
  • Loading branch information
dlom committed Nov 2, 2015
1 parent 375f650 commit 1b867f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
*.o
*.so
*.a
test
22 changes: 7 additions & 15 deletions Makefile
@@ -1,9 +1,3 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_PATCH = 0

VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)

PREFIX ?= /usr
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include
Expand All @@ -13,19 +7,17 @@ CC_FLAGS = -Wall -Wextra -std=gnu99 -pedantic

.PHONY: all install clean

all: libhc.so
all: libhc.a

hc.o: hc.c hc.h hc_private.h
$(CC) $(CC_FLAGS) -fPIC -c hc.c -o hc.o
$(CC) $(CC_FLAGS) -c hc.c -o hc.o

libhc.so: hc.o
$(CC) $(CC_FLAGS) -fPIC -shared hc.o -o libhc.so
libhc.a: hc.o
ar rcs libhc.a hc.o

install: libhc.so hc.h
install -Dm755 libhc.so $(DESTDIR)$(LIBDIR)/libhc.so.$(VERSION)
install: libhc.a hc.h
install -Dm755 libhc.a $(DESTDIR)$(LIBDIR)/libhc.a
install -Dm644 hc.h $(DESTDIR)$(INCLUDEDIR)/hc.h
cd $(DESTDIR)$(LIBDIR) && ln -s libhc.so.$(VERSION) libhc.so.$(VERSION_MAJOR)
cd $(DESTDIR)$(LIBDIR) && ln -s libhc.so.$(VERSION) libhc.so

clean:
rm -f hc.o libhc.so
rm -f hc.o libhc.a

0 comments on commit 1b867f8

Please sign in to comment.