updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / oscpack / Makefile
blobbe6480d1425714f6e98e5c1999430d821cb57752
1 ENDIANESS=OSC_HOST_LITTLE_ENDIAN
3 CXX = g++
4 INCLUDES = -I./
5 COPTS = -Wall -O3
6 CDEBUG = -Wall -g
7 CXXFLAGS = -fPIC -DPIC $(COPTS) $(INCLUDES) -D$(ENDIANESS)
9 PREFIX = /usr/
10 INSTALL = /bin/install -c
12 #Name definitions
13 UNITTESTS=OscUnitTests
14 SEND=OscSendTests
15 RECEIVE=OscReceiveTest
16 DUMP=OscDump
18 INCLUDEDIR = oscpack
19 LIBNAME = liboscpack
20 LIBSONAME = $(LIBNAME).so
21 LIBFILENAME = $(LIBSONAME).1.0.2
23 #Test and example source
24 SENDSOURCES = ./tests/OscSendTests.cpp ./osc/OscOutboundPacketStream.cpp ./osc/OscTypes.cpp ./ip/posix/NetworkingUtils.cpp ./ip/posix/UdpSocket.cpp ./ip/IpEndpointName.cpp
25 SENDOBJECTS = $(SENDSOURCES:.cpp=.o)
27 RECEIVESOURCES = ./tests/OscReceiveTest.cpp ./osc/OscTypes.cpp ./osc/OscReceivedElements.cpp ./osc/OscPrintReceivedElements.cpp ./ip/posix/NetworkingUtils.cpp ./ip/posix/UdpSocket.cpp
28 RECEIVEOBJECTS = $(RECEIVESOURCES:.cpp=.o)
30 DUMPSOURCES = ./examples/OscDump.cpp ./osc/OscTypes.cpp ./osc/OscReceivedElements.cpp ./osc/OscPrintReceivedElements.cpp ./ip/posix/NetworkingUtils.cpp ./ip/posix/UdpSocket.cpp
31 DUMPOBJECTS = $(DUMPSOURCES:.cpp=.o)
33 UNITTESTSOURCES = ./tests/OscUnitTests.cpp ./osc/OscOutboundPacketStream.cpp ./osc/OscTypes.cpp ./osc/OscReceivedElements.cpp ./osc/OscPrintReceivedElements.cpp
34 UNITTESTOBJECTS = $(UNITTESTSOURCES:.cpp=.o)
36 #Library sources
37 LIBSOURCES = ./ip/IpEndpointName.cpp \
38 ./ip/posix/NetworkingUtils.cpp ./ip/posix/UdpSocket.cpp\
39 ./osc/OscOutboundPacketStream.cpp ./osc/OscPrintReceivedElements.cpp ./osc/OscReceivedElements.cpp ./osc/OscTypes.cpp
40 LIBOBJECTS = $(LIBSOURCES:.cpp=.o)
42 all: unittests send receive dump
44 unittests : $(UNITTESTOBJECTS)
45 @if [ ! -d bin ] ; then mkdir bin ; fi
46 $(CXX) -o bin/$(UNITTESTS) $+ $(LIBS)
47 send : $(SENDOBJECTS)
48 @if [ ! -d bin ] ; then mkdir bin ; fi
49 $(CXX) -o bin/$(SEND) $+ $(LIBS)
50 receive : $(RECEIVEOBJECTS)
51 @if [ ! -d bin ] ; then mkdir bin ; fi
52 $(CXX) -o bin/$(RECEIVE) $+ $(LIBS)
53 dump : $(DUMPOBJECTS)
54 @if [ ! -d bin ] ; then mkdir bin ; fi
55 $(CXX) -o bin/$(DUMP) $+ $(LIBS)
57 clean:
58 rm -rf bin $(UNITTESTOBJECTS) $(SENDOBJECTS) $(RECEIVEOBJECTS) $(DUMPOBJECTS) $(LIBOBJECTS) $(LIBFILENAME) include lib oscpack &> /dev/null
60 $(LIBFILENAME): $(LIBOBJECTS)
61 @#GNU/Linux case
62 $(CXX) -shared -Wl,-soname,$(LIBSONAME) -o $(LIBFILENAME) $(LIBOBJECTS) -lc
63 @#Mac OS X case
64 @#$(CXX) -dynamiclib -Wl,-install_name,$(LIBSONAME) -o $(LIBFILENAME) $(LIBOBJECTS) -lc
66 lib: $(LIBFILENAME)
68 #Installs the library on a system global location
69 install: lib
70 @$(INSTALL) -m 755 $(LIBFILENAME) $(PREFIX)/lib/$(LIBFILENAME)
71 @ln -s -f $(PREFIX)/lib/$(LIBFILENAME) $(PREFIX)/lib/$(LIBSONAME)
72 @mkdir -p $(PREFIX)/include/oscpack/ip $(PREFIX)/include/oscpack/osc
73 @$(INSTALL) -m 644 ip/*.h $(PREFIX)/include/oscpack/ip
74 @$(INSTALL) -m 644 osc/*.h $(PREFIX)/include/oscpack/osc
75 @echo "SUCCESS! oscpack has been installed in $(PREFIX)/lib and $(PREFIX)/include/ospack/"
77 #Installs the include/lib structure locally
78 install-local: lib
79 @echo ""
80 @echo " Installing in local directory <$(INCLUDEDIR)>"
81 @echo " > Creating symbolic link"
82 @ln -s $(LIBFILENAME) $(LIBSONAME)
83 @echo " > Creating directories"
84 @mkdir -p oscpack/lib
85 @mkdir -p oscpack/include/ip
86 @mkdir -p oscpack/include/osc
87 @echo " > Copying files"
88 @mv $(LIBFILENAME) $(LIBSONAME) oscpack/lib
89 @cp ip/*.h oscpack/include/ip
90 @cp osc/*.h oscpack/include/osc
91 @echo ""
92 @echo " > Success!"