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