Skip to content

Commit

Permalink
Merge pull request #33 from opengear/makefile-fixes-for-yocto
Browse files Browse the repository at this point in the history
Makefile fixes for yocto / bitbake
  • Loading branch information
deepfryed committed Nov 2, 2016
2 parents 477ac77 + e7fceb5 commit 851ef51
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions makefile
Expand Up @@ -27,22 +27,22 @@ endif
STATICLIB = libbeanstalk.a
CFLAGS = -Wall -Wno-sign-compare -g -I.
LDFLAGS = -L. -lbeanstalk
CC = gcc
CPP = g++
CC ?= gcc
CXX ?= g++

all: $(CEXAMPLES) $(CPPEXAMPLES) benchmark

test: $(TESTS)
test/run-all

$(TESTS): test/%:test/%.o $(SHAREDLIB)
$(CPP) -o $@ $< $(LDFLAGS) -lgtest -lpthread
$(CXX) -o $@ $< $(LDFLAGS) -lgtest -lpthread

test/%.o: test/%.cc
$(CPP) $(CFLAGS) -c -o $@ $<
$(CXX) $(CFLAGS) -c -o $@ $<

benchmark: benchmark.cc $(SHAREDLIB)
$(CPP) $(CFLAGS) -o benchmark benchmark.cc $(LDFLAGS) -lpthread
$(CXX) $(CFLAGS) -o benchmark benchmark.cc $(LDFLAGS) -lpthread

$(CEXAMPLES): examples/c/%:examples/c/%.o $(SHAREDLIB)
$(CC) -o $@ $< $(LDFLAGS)
Expand All @@ -51,25 +51,25 @@ examples/c/%.o: examples/c/%.c
$(CC) $(CFLAGS) -c -o $@ $<

$(CPPEXAMPLES): examples/cpp/%:examples/cpp/%.o $(SHAREDLIB)
$(CPP) -o $@ $< $(LDFLAGS)
$(CXX) -o $@ $< $(LDFLAGS)

examples/cpp/%.o: examples/cpp/%.cc
$(CPP) $(CFLAGS) -c -o $@ $<
$(CXX) $(CFLAGS) -c -o $@ $<

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

$(SHAREDLIB): beanstalk.o beanstalkcpp.o
$(CPP) $(LINKER) -o $(SHAREDLIB) beanstalk.o beanstalkcpp.o
$(CXX) $(LINKER) -o $(SHAREDLIB) beanstalk.o beanstalkcpp.o
rm -f $(SHAREDLIB).1
ln -s $(SHAREDLIB) $(SHAREDLIB).1

beanstalk.o: beanstalk.c beanstalk.h makefile
$(CC) $(CFLAGS) -fPIC -c -o beanstalk.o beanstalk.c

beanstalkcpp.o: beanstalk.cc beanstalk.hpp makefile
$(CPP) $(CFLAGS) -fPIC -c -o beanstalkcpp.o beanstalk.cc
$(CXX) $(CFLAGS) -fPIC -c -o beanstalkcpp.o beanstalk.cc

install: $(SHAREDLIB) $(STATICLIB)
install -d $(DESTDIR)$(INCLUDEDIR)
Expand Down

0 comments on commit 851ef51

Please sign in to comment.