Skip to content

Commit

Permalink
makefile now installs static library as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Edgin committed Dec 3, 2012
1 parent f15e871 commit 5480d87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.o
*.a
*.so
*.dylib
*.dSYM
Expand All @@ -10,3 +11,5 @@ test/*
!test/*.cc
benchmark
siege*
.cproject
.project
11 changes: 10 additions & 1 deletion makefile
Expand Up @@ -17,6 +17,7 @@ SHAREDLIB = libbeanstalk.so
LNOPTS = -sfT
endif

STATICLIB = libbeanstalk.a
CFLAGS = -Wall -Wno-sign-compare -g -I.
LDFLAGS = -L. -lbeanstalk
CC = gcc
Expand Down Expand Up @@ -48,6 +49,10 @@ $(CPPEXAMPLES): examples/cpp/%:examples/cpp/%.o $(SHAREDLIB)
examples/cpp/%.o: examples/cpp/%.cc
$(CPP) $(CFLAGS) -c -o $@ $<

$(STATICLIB): beanstalk.o beanstalkcpp.o
rm -f $@
ar -cq $@ $^

$(SHAREDLIB): beanstalk.o beanstalkcpp.o
$(CPP) -shared -o $(SHAREDLIB) beanstalk.o beanstalkcpp.o

Expand All @@ -57,17 +62,21 @@ beanstalk.o: beanstalk.c beanstalk.h makefile
beanstalkcpp.o: beanstalk.cc beanstalk.hpp makefile
$(CPP) $(CFLAGS) -fPIC -c -o beanstalkcpp.o beanstalk.cc

install: $(SHAREDLIB)
install: $(SHAREDLIB) $(STATICLIB)
cp beanstalk.h /usr/include
cp beanstalk.hpp /usr/include
cp $(SHAREDLIB) /usr/lib/$(SHAREDLIB).$(VERSION)
ln $(LNOPTS) /usr/lib/$(SHAREDLIB).$(VERSION) /usr/lib/$(SHAREDLIB).1
ln $(LNOPTS) /usr/lib/$(SHAREDLIB).$(VERSION) /usr/lib/$(SHAREDLIB)
cp $(STATICLIB) /usr/lib/$(STATICLIB).$(VERSION)
ln $(LNOPTS) /usr/lib/$(STATICLIB).$(VERSION) /usr/lib/$(STATICLIB).1
ln $(LNOPTS) /usr/lib/$(STATICLIB).$(VERSION) /usr/lib/$(STATICLIB)

uninstall:
rm -f /usr/include/beanstalk.h
rm -f /usr/include/beanstalk.hpp
rm -f /usr/lib/$(SHAREDLIB)*
rm -f /usr/lib/$(STATICLIB)*

clean:
rm -f *.o *.so *.so.* test/test[0-9] test/*.o examples/**/*.o examples/**/example?

0 comments on commit 5480d87

Please sign in to comment.