Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create `Makefile` to build UDT4 and C++ examples.

Created a `Makefile` that will download and build the UDT4 C++ reference
implementation and build it along with our C++ example programs. We're
going to use the server side of the C++ programs as part of our strategy
to ensure that we conform to the protocol, testing against the UDT4 C++
reference on the platforms where it will easily compile, ensuring
protocol parity between the C++ and JavaScript implementations.
  • Loading branch information...
commit 02292948a7d56b54f7b6621033885618709ac094 1 parent a9e813b
@bigeasy authored
Showing with 37 additions and 64 deletions.
  1. +1 −0  .gitignore
  2. +36 −0 Makefile
  3. +0 −1  NOTES
  4. +0 −63 sdk/Makefile
View
1  .gitignore
@@ -1,4 +1,5 @@
node_modules/*
+build/*
sdk/*/*.o
sdk/*/client
sdk/*/server
View
36 Makefile
@@ -0,0 +1,36 @@
+sources = $(wildcard sdk/*/*.cpp)
+targets = $(sources:%.cpp=%)
+sdk = build/udt4/src
+
+UNAME := $(shell uname)
+
+ifeq ($(UNAME), Darwin)
+ LIBUDT = libudt.dylib
+ OS = OSX
+else
+ LIBUDT = libudt.so
+ OS = Linux
+endif
+
+LDFLAGS = -L$(sdk) -ludt -lstdc++ -lpthread -lm
+CCFLAGS = -Wall -D$(OS) -I$(sdk) -finline-functions -O3
+
+all: $(targets)
+
+$(targets): %: %.cpp build/udt4/src/$(LIBUDT)
+ gcc $< -o $@ $(LDFLAGS) $(CCFLAGS)
+
+build/udt4/src/$(LIBUDT): build/udt4/Makefile
+ make -e os=$(OS) -C build/udt4
+
+build/udt4/Makefile: build/udt.sdk.4.10.tar.gz
+ tar -C build -zxf $<
+ touch $@
+
+build/udt.sdk.4.10.tar.gz:
+ @mkdir -p build
+ curl -Ls http://downloads.sourceforge.net/project/udt/udt/4.10/udt.sdk.4.10.tar.gz > $@.tmp
+ [ "$$(cat $@.tmp | $$(which md5sum || which md5) | cut -f1 -d' ')" == "6bb2d8454d67c920eb446fddb7d030c4" ] && mv $@.tmp $@
+
+clean:
+ rm -rf build
View
1  NOTES
@@ -1,6 +1,5 @@
Things that I'm running on occasion.
-(cd sdk && make -e os=OSX sdk=~/src/udt4/src)
DYLD_LIBRARY_PATH=~/src/udt4/src sdk/file/server
DYLD_LIBRARY_PATH=~/src/udt4/src sdk/file/client 127.0.0.1 9293 index.js
View
63 sdk/Makefile
@@ -1,63 +0,0 @@
-C++ = g++
-
-ifndef os
- os = LINUX
-endif
-
-ifndef arch
- arch = IA32
-endif
-
-CCFLAGS = -Wall -D$(os) -I$(sdk) -finline-functions -O3
-
-ifeq ($(arch), IA32)
- CCFLAGS += -DIA32 #-mcpu=pentiumpro -march=pentiumpro -mmmx -msse
-endif
-
-ifeq ($(arch), POWERPC)
- CCFLAGS += -mcpu=powerpc
-endif
-
-ifeq ($(arch), IA64)
- CCFLAGS += -DIA64
-endif
-
-ifeq ($(arch), SPARC)
- CCFLAGS += -DSPARC
-endif
-
-LDFLAGS = -L$(sdk) -ludt -lstdc++ -lpthread -lm
-
-ifeq ($(os), UNIX)
- LDFLAGS += -lsocket
-endif
-
-ifeq ($(os), SUNOS)
- LDFLAGS += -lrt -lsocket
-endif
-
-DIR = $(shell pwd)
-
-APP = file/client file/server connect/client integer/client integer/server
-
-all: $(APP)
-
-%.o: %.cpp
- $(C++) $(CCFLAGS) $< -c -o $@
-
-file/server: file/server.o
- $(C++) $^ -o $@ $(LDFLAGS)
-file/client: file/client.o
- $(C++) $^ -o $@ $(LDFLAGS)
-connect/client: connect/client.o
- $(C++) $^ -o $@ $(LDFLAGS)
-integer/server: integer/server.o
- $(C++) $^ -o $@ $(LDFLAGS)
-integer/client: integer/client.o
- $(C++) $^ -o $@ $(LDFLAGS)
-
-clean:
- rm -f */*.o $(APP)
-
-install:
- export PATH=$(DIR):$$PATH
Please sign in to comment.
Something went wrong with that request. Please try again.