Permalink
Browse files

Add BSD/Mac Makefile support

  • Loading branch information...
1 parent 31559b0 commit 55c9b3fad9b8df5d30f5811d424c1b5ea5be67e6 @jjwhitney committed Nov 2, 2012
Showing with 12 additions and 11 deletions.
  1. +12 −3 src/Makefile
  2. +0 −8 src/Makefile.OSX
View
@@ -4,18 +4,27 @@ BINDIR ?= $(PREFIX)/bin
LIBDIR ?= ${PREFIX}/lib
CXXFLAGS += -O2
-ALL_TARGETS = bpatch libbdelta.so bdelta
+ifeq ($(shell uname -s),Darwin)
+ SHAREDLIB := libbdelta.dylib
+else
+ SHAREDLIB := libbdelta.so
+endif
+
+ALL_TARGETS = bpatch $(SHAREDLIB) bdelta
all: $(ALL_TARGETS)
libbdelta.a: libbdelta.cpp compatibility.h checksum.h file.h
$(CXX) -c $(CXXFLAGS) $< -o $<.o
- $(AR) rfs $@ $<.o
+ $(AR) rs $@ $<.o
libbdelta.so: libbdelta.cpp compatibility.h checksum.h file.h
$(CXX) -shared -fPIC $(CXXFLAGS) $(LDFLAGS) $< -o $@
-bdelta: bdelta.cpp bdelta.h compatibility.h file.h libbdelta.so
+libbdelta.dylib: libbdelta.cpp compatibility.h checksum.h file.h
+ $(CXX) -dynamiclib $(CXXFLAGS) $< -o $@
+
+bdelta: bdelta.cpp bdelta.h compatibility.h file.h $(SHAREDLIB)
$(CXX) $< -o $@ $(CXXFLAGS) $(LDFLAGS) -L. -lbdelta
bpatch: bpatch.cpp compatibility.h bdelta.h file.h
View
@@ -1,8 +0,0 @@
-CXXFLAGS=-D NDEBUG -O3
-all: libbdelta.dylib bdelta bpatch
-libbdelta.dylib: libbdelta.cpp compatibility.h container.h checksum.h file.h
- ${CC} -dynamiclib -lstdc++ ${CXXFLAGS} $< -o $@
-bdelta: bdelta.cpp compatibility.h bdelta.h container.h file.h
- ${CC} $< -L. -lbdelta -lstdc++ -o $@
-bpatch: bpatch.cpp compatibility.h bdelta.h file.h
- ${CC} $< -L. -lstdc++ -o $@

0 comments on commit 55c9b3f

Please sign in to comment.