Permalink
Browse files

alter makefile to produce both static and dynamic versions of ozwd

  • Loading branch information...
1 parent fb32bca commit b3a4c17195cb8dc0051eab3b9ecdbcce67e348f7 @ekarak ekarak committed Mar 14, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 Makefile
View
@@ -37,7 +37,8 @@ INCLUDES := -I $(OPENZWAVE)/cpp/src -I $(OPENZWAVE)/cpp/src/command_classes/ \
GNUTLS := -lgnutls
# for Linux uncomment out next two lines
-LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/linux/*.a)
+LIBZWAVE_STATIC := $(OPENZWAVE)/cpp/lib/linux/openzwave.a
+LIBZWAVE_DYNAMIC := $(OPENZWAVE)/cpp/lib/linux/openzwave.so
LIBUSB := -ludev
LIBPOCO := -lPocoNet -lPocoFoundation -lboost_thread -lboost_program_options
LIBTHRIFT := -lthrift
@@ -46,18 +47,18 @@ LIBTHRIFT := -lthrift
#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
#LIBUSB := -framework IOKit -framework CoreFoundation
-LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBTHRIFT) $(LIBUSB) $(LIBPOCO)
+LIBS := $(GNUTLS) $(LIBTHRIFT) $(LIBUSB) $(LIBPOCO)
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
-all: openzwave main
+all: openzwave ozwd ozwd.static
gen-cpp/RemoteManager_server.cpp: create_server.rb gen-cpp/RemoteManager.cpp
- ruby1.9.1 create_server.rb --ozwroot=${OPENZWAVE} --thriftroot=$(THRIFT)
+ ruby create_server.rb --ozwroot=${OPENZWAVE} --thriftroot=$(THRIFT)
cp gen-cpp/RemoteManager_server.cpp gen-cpp/RemoteManager_server.cpp.orig
cp gen-cpp/ozw_types.h gen-cpp/ozw_types.h.orig
patch -p0 gen-cpp/RemoteManager_server.cpp < gen-cpp/RemoteManager_server.cpp.patch
@@ -93,10 +94,11 @@ Main.o: Main.cpp Stomp_sm.o gen-cpp/RemoteManager_server.cpp
openzwave:
cd $(OPENZWAVE)/cpp/build/linux/; make
+ozwd.static: Main.o Stomp_sm.o StompSocket.o PocoStomp.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE)
+ $(LD) -o $@ $(LDFLAGS) Main.o Stomp_sm.o StompSocket.o PocoStomp.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE_STATIC) $(LIBS)
+
ozwd: Main.o Stomp_sm.o StompSocket.o PocoStomp.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE)
- $(LD) -o $@ $(LDFLAGS) Main.o Stomp_sm.o StompSocket.o PocoStomp.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBS)
-
-main: ozwd
+ $(LD) -o $@ $(LDFLAGS) Main.o Stomp_sm.o StompSocket.o PocoStomp.o gen-cpp/RemoteManager.o gen-cpp/ozw_constants.o gen-cpp/ozw_types.o $(LIBZWAVE_DYNAMIC) $(LIBS)
dist: main
rm -f Thrift4OZW.tar.gz
@@ -115,6 +117,5 @@ binclean:
thrift: gen-cpp/RemoteManager.cpp
patchdiffs:
- - diff -C5 gen-cpp/ozw_types.h.orig gen-cpp/ozw_types.h.patched > gen-cpp/ozw_types.h.patch
- - diff -C5 gen-cpp/RemoteManager_server.cpp.orig gen-cpp/RemoteManager_server.cpp.patched > gen-cpp/RemoteManager_server.cpp.patch
-
+ - diff -C3 gen-cpp/ozw_types.h.orig gen-cpp/ozw_types.h.patched > gen-cpp/ozw_types.h.patch
+ - diff -C3 gen-cpp/RemoteManager_server.cpp.orig gen-cpp/RemoteManager_server.cpp.patched > gen-cpp/RemoteManager_server.cpp.patch

0 comments on commit b3a4c17

Please sign in to comment.