Permalink
Browse files

fix makefile

  • Loading branch information...
1 parent d905da1 commit ff256764e9fb0cb772c5f1b4fe04c96ed895f20e @deepfryed committed Mar 3, 2012
Showing with 10 additions and 15 deletions.
  1. +10 −15 makefile
View
25 makefile
@@ -1,33 +1,29 @@
-E_SOURCES := $(wildcard examples/*.c)
-E_OBJECTS := $(E_SOURCES:%.c=%.o)
-E_ELVES := $(E_SOURCES:%.c=%)
-
-T_SOURCES := $(wildcard test/*.cc)
-T_OBJECTS := $(T_SOURCES:%.cc=%.o)
-T_ELVES := $(T_SOURCES:%.cc=%)
+SOURCES1 := $(wildcard examples/*.c)
+SOURCES2 := $(wildcard test/*.cc)
+EXAMPLES := $(SOURCES1:%.c=%)
+TESTS := $(SOURCES2:%.cc=%)
SHAREDLIB = /usr/lib/libbeanstalk.so.1.0.0
CFLAGS = -Wall -g -I.
LDFLAGS = -L. -lbeanstalk
-
CC = gcc
CPP = g++
-all: $(E_ELVES)
+all: $(EXAMPLES)
-test: $(T_ELVES)
+test: $(TESTS)
test/run-all
-$(T_ELVES): $(T_OBJECTS) libbeanstalk.so
+$(TESTS): test/%:test/%.o libbeanstalk.so
$(CPP) -o $@ $< $(LDFLAGS) -lgtest -lpthread
-$(T_OBJECTS): $(T_SOURCES)
+test/%.o: test/%.cc
$(CPP) $(CFLAGS) -c -o $@ $<
-$(E_ELVES): $(E_OBJECTS) libbeanstalk.so
+$(EXAMPLES): examples/%:examples/%.o libbeanstalk.so
$(CC) -o $@ $< $(LDFLAGS)
-$(E_OBJECTS): $(E_SOURCES)
+examples/%.o: examples/%.c
$(CC) $(CFLAGS) -c -o $@ $<
libbeanstalk.so: beanstalk.o
@@ -36,7 +32,6 @@ libbeanstalk.so: beanstalk.o
beanstalk.o: beanstalk.c makefile
gcc -fPIC -c -o beanstalk.o beanstalk.c
-
install: libbeanstalk.so
cp beanstalk.h /usr/include
cp libbeanstalk.so $(SHAREDLIB)

0 comments on commit ff25676

Please sign in to comment.