    chain.h \
    chainparams.h \
    chainparamsbase.h \
-@@ -152,10 +156,17 @@ JSON_H = \
+@@ -152,10 +155,17 @@ JSON_H = \
    json/json_spirit_writer.h \
    json/json_spirit_writer_template.h
  

 	-$(MAKE) -C $(top_distdir)/src/leveldb clean
 	-$(MAKE) -C $(top_distdir)/src/secp256k1 distclean
diff --git a/configure.ac b/configure.ac
index 9814197..3f25415 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,6 +126,12 @@ AC_ARG_ENABLE([reduce-exports],

+libbitcoind_obj += compat/glibcxx_compat.o
+endif
+
+CXXFLAGS += -I./leveldb/helpers/memenv
+COMMAND = $(CC) -dynamiclib \
+	-lc++ -lcrypto -L/usr/lib -lminiupnpc \
+	$(CXXFLAGS) $(CPPFLAGS) $(DEFS) $(LEVELDB_CPPFLAGS) \
+	$(BITCOIN_INCLUDES) $(BITCOIN_CONFIG_INCLUDES) $(BOOST_LIBS) \
+	$(BDB_LIBS) $(PROTOBUF_LIBS) $(SSL_LIBS) $(LIBS) \
+	$(leveldb_obj) $(libbitcoind_obj) \
+	./secp256k1/libsecp256k1_la-secp256k1.o \
+        -o libbitcoind.dylib 
+
+clientversion.o: clientversion.cpp obj/build.h
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	  $(BITCOIN_INCLUDES) $(BITCOIN_CONFIG_INCLUDES) \
+	  $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
+do:
+	@echo "$(COMMAND)"
+
+$(LIBBITCOIND): $(LIBLEVELDB) $(LIBMEMENV) $(LIBSECP256K1) $(libbitcoind_obj)
+	$(COMMAND)
diff --git a/src/bitcoin-main.cpp b/src/bitcoin-main.cpp
new file mode 100644
index 0000000..b37f9cf
